textbox opens
This commit is contained in:
parent
6045a205fd
commit
ed024aac70
|
@ -150,6 +150,7 @@ func (tk *guiWidget) showTextbox() {
|
||||||
// updates the text and sends an event back to the application
|
// updates the text and sends an event back to the application
|
||||||
func (tk *guiWidget) textboxClosed() {
|
func (tk *guiWidget) textboxClosed() {
|
||||||
tk.Hide()
|
tk.Hide()
|
||||||
|
me.textbox.active = false
|
||||||
|
|
||||||
// get the text the user entered
|
// get the text the user entered
|
||||||
newname := tk.GetText()
|
newname := tk.GetText()
|
||||||
|
|
|
@ -130,6 +130,11 @@ func doEsc(g *gocui.Gui, v *gocui.View) error {
|
||||||
me.dropdown.active = false
|
me.dropdown.active = false
|
||||||
log.Info("escaped from dropdown")
|
log.Info("escaped from dropdown")
|
||||||
}
|
}
|
||||||
|
if me.textbox.active {
|
||||||
|
me.textbox.tk.Hide()
|
||||||
|
me.textbox.active = false
|
||||||
|
log.Info("escaped from textbox")
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,10 @@ func doMouseClick(w int, h int) {
|
||||||
log.Info("got dropdwon click", w, h, tk.cuiName)
|
log.Info("got dropdwon click", w, h, tk.cuiName)
|
||||||
tk.dropdownClicked(w, h)
|
tk.dropdownClicked(w, h)
|
||||||
}
|
}
|
||||||
|
if tk.node.WidgetId == me.textbox.wId {
|
||||||
|
log.Info("got textbox click", w, h, tk.cuiName)
|
||||||
|
tk.textboxClosed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -127,6 +131,17 @@ func doMouseClick(w int, h int) {
|
||||||
// priority widgets. send the click here first
|
// priority widgets. send the click here first
|
||||||
for _, tk := range findByXY(w, h) {
|
for _, tk := range findByXY(w, h) {
|
||||||
switch tk.node.WidgetType {
|
switch tk.node.WidgetType {
|
||||||
|
case widget.Checkbox:
|
||||||
|
if tk.node.State.Checked {
|
||||||
|
log.Log(WARN, "checkbox is being set to false")
|
||||||
|
tk.node.State.Checked = false
|
||||||
|
tk.setCheckbox()
|
||||||
|
} else {
|
||||||
|
log.Log(WARN, "checkbox is being set to true")
|
||||||
|
tk.node.State.Checked = true
|
||||||
|
tk.setCheckbox()
|
||||||
|
}
|
||||||
|
me.myTree.SendUserEvent(tk.node)
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
me.myTree.SendFromUser(tk.node)
|
me.myTree.SendFromUser(tk.node)
|
||||||
return
|
return
|
||||||
|
@ -140,7 +155,8 @@ func doMouseClick(w int, h int) {
|
||||||
tk.showTextbox()
|
tk.showTextbox()
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
tk.dumpWidget("undef click()")
|
// TODO: enable the GUI debugger in gocui
|
||||||
|
// tk.dumpWidget("undef click()") // enable this to debug widget clicks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue