Update code for layouts, objects

This commit is contained in:
2024-07-21 11:48:28 -04:00
parent 9077015db6
commit 6ca6771fc6
26 changed files with 447 additions and 389 deletions

View File

@@ -19,8 +19,8 @@ type TextInput struct {
// NewTextInput creates a new text input containing the specified text.
func NewTextInput (text string) *TextInput {
this := &TextInput { TextBox: tomo.NewTextBox() }
this.SetRole(tomo.R("objects", "TextInput", ""))
this.SetAlign(tomo.AlignStart, tomo.AlignMiddle)
this.SetRole(tomo.R("objects", "TextInput"))
this.SetAttr(tomo.AAlign(tomo.AlignStart, tomo.AlignMiddle))
this.SetText(text)
this.SetFocusable(true)
this.SetSelectable(true)
@@ -53,9 +53,9 @@ func (this *TextInput) OnValueChange (callback func ()) event.Cookie {
return this.on.valueChange.Connect(callback)
}
func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
func (this *TextInput) handleKeyDown (catch func (), key input.Key, numpad bool) {
dot := this.Dot()
modifiers := this.Modifiers()
modifiers := this.Window().Modifiers()
word := modifiers.Control
sel := modifiers.Shift
changed := false
@@ -113,6 +113,6 @@ func (this *TextInput) Type (char rune) {
this.SetText(string(this.text))
}
func (this *TextInput) handleScroll (x, y float64) {
func (this *TextInput) handleScroll (catch func (), x, y float64) {
this.ScrollTo(this.ContentBounds().Min.Add(image.Pt(int(x), int(y))))
}