Disabled inputs can no longer be selected

This commit is contained in:
Sasha Koshka 2023-01-18 01:21:49 -05:00
parent 3ef13955be
commit 46268c8d02
2 changed files with 2 additions and 0 deletions

View File

@ -39,6 +39,7 @@ func (element *TextBox) Resize (width, height int) {
} }
func (element *TextBox) HandleMouseDown (x, y int, button tomo.Button) { func (element *TextBox) HandleMouseDown (x, y int, button tomo.Button) {
if !element.enabled { return }
element.Select() element.Select()
} }

View File

@ -17,6 +17,7 @@ func run () {
firstName := basic.NewTextBox("First name", "") firstName := basic.NewTextBox("First name", "")
lastName := basic.NewTextBox("Last name", "") lastName := basic.NewTextBox("Last name", "")
lastName.SetEnabled(false)
fingerLength := basic.NewTextBox("Length of fingers", "") fingerLength := basic.NewTextBox("Length of fingers", "")
button := basic.NewButton("Ok") button := basic.NewButton("Ok")