13
textinput.go
13
textinput.go
@@ -11,8 +11,8 @@ type TextInput struct {
|
||||
tomo.TextBox
|
||||
text []rune
|
||||
on struct {
|
||||
enter event.FuncBroadcaster
|
||||
edit event.FuncBroadcaster
|
||||
enter event.FuncBroadcaster
|
||||
valueChange event.FuncBroadcaster
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,10 @@ func (this *TextInput) OnEnter (callback func ()) event.Cookie {
|
||||
return this.on.enter.Connect(callback)
|
||||
}
|
||||
|
||||
// OnEdit specifies a function to be called when the user edits the input text.
|
||||
func (this *TextInput) OnEdit (callback func ()) event.Cookie {
|
||||
return this.on.edit.Connect(callback)
|
||||
// OnValueChange specifies a function to be called when the user edits the input
|
||||
// text.
|
||||
func (this *TextInput) OnValueChange (callback func ()) event.Cookie {
|
||||
return this.on.valueChange.Connect(callback)
|
||||
}
|
||||
|
||||
func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
|
||||
@@ -100,7 +101,7 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
|
||||
this.Select(dot)
|
||||
if changed {
|
||||
this.SetText(string(this.text))
|
||||
this.on.edit.Broadcast()
|
||||
this.on.valueChange.Broadcast()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user