button.go
func CreateButton(parent Control, width, height int, title string, scale int) *Button {
	b := new(Button)
	b.BaseControl = NewBaseControl()

	b.parent = parent
	b.align = AlignCenter

	if height == AutoSize {
		height = 4
	}
	if width == AutoSize {
		width = xs.Len(title) + 2 + 1
	}

	if height < 4 {
		height = 4
	}
	if width < 6 {
		width = 6
	}

	b.SetTitle(title)
	b.SetSize(width, height)
	b.SetConstraints(width, height)
	b.SetScale(scale)

	if parent != nil {
		parent.AddChild(b)
	}

	return b
}
func CreateButton(parent Control, width, height int, title string, scale int) *Button {
	b := new(Button)
	b.BaseControl = NewBaseControl()

	b.parent = parent
	b.align = AlignCenter

	if height == AutoSize {
		height = 4
	}
	if width == AutoSize {
		width = xs.Len(title) + 2 + 1
	}

	if height < 4 {
		height = 4
	}
	if width < 6 {
		width = 6
	}

	b.SetTitle(title)
	b.SetSize(width, height)
	b.SetConstraints(width, height)
	b.SetScale(scale)

	if parent != nil {
		parent.AddChild(b)
	}

	return b
}
func CreateButton ( parent Control , width , height int , title string , scale int ) * Button { b := new ( Button ) b . BaseControl = NewBaseControl ( ) b . parent = parent b . align = AlignCenter if height == AutoSize { height = 4 } if width == AutoSize { width = xs . Len ( title ) + 2 + 1 } if height < 4 { height = 4 } if width < 6 { width = 6 } b . SetTitle ( title ) b . SetSize ( width , height ) b . SetConstraints ( width , height ) b . SetScale ( scale ) if parent != nil { parent . AddChild ( b ) } return b }
/*
NewButton creates a new Button.
view - is a View that manages the control
parent - is container that keeps the control. The same View can be a view and a parent at the same time.
width and heigth - are minimal size of the control.
title - button title.
scale - the way of scaling the control when the parent is resized. Use DoNotScale constant if the
control should keep its original size.
*/
/ * NewButton creates a new Button . view - is a View that manages the control parent - is container that keeps the control . The same View can be a view and a parent at the same time . width and heigth - are minimal size of the control . title - button title . scale - the way of scaling the control when the parent is resized . Use DoNotScale constant if the control should keep its original size .