dropdown menu works again
This commit is contained in:
parent
7b06b81ed3
commit
227419c1ad
|
@ -80,6 +80,7 @@ func (tk *guiWidget) showDropdown() {
|
||||||
// if there is a drop down view active, treat it like a dialog box and close it
|
// if there is a drop down view active, treat it like a dialog box and close it
|
||||||
func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string {
|
func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string {
|
||||||
w.Hide()
|
w.Hide()
|
||||||
|
me.dropdown.active = false
|
||||||
|
|
||||||
// only need height to figure out what line in the dropdown menu the user clicked
|
// only need height to figure out what line in the dropdown menu the user clicked
|
||||||
_, startH := w.Position()
|
_, startH := w.Position()
|
||||||
|
@ -106,6 +107,7 @@ func (w *guiWidget) dropdownClicked(mouseW, mouseH int) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func dropdownUnclicked(w, h int) {
|
func dropdownUnclicked(w, h int) {
|
||||||
var d *guiWidget
|
var d *guiWidget
|
||||||
|
|
||||||
|
@ -122,6 +124,7 @@ func dropdownUnclicked(w, h int) {
|
||||||
}
|
}
|
||||||
// log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV")
|
// log.Log(GOCUI, "dropdownUnclicked()", d.node.Strings(), "end. now try to enable me.dropdownV")
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (tk *guiWidget) showTextbox() {
|
func (tk *guiWidget) showTextbox() {
|
||||||
if me.textbox.tk == nil {
|
if me.textbox.tk == nil {
|
||||||
|
|
|
@ -110,23 +110,37 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
||||||
|
|
||||||
// handles a mouse click
|
// handles a mouse click
|
||||||
func doMouseClick(w int, h int) {
|
func doMouseClick(w int, h int) {
|
||||||
dropdownUnclicked(w, h)
|
// Flag widgets (dropdown menus, etc) are the highest priority. ALWAYS SEND MOUSE CLICKS THERE FIRST
|
||||||
|
// handle an open dropdown menu or text entry window first
|
||||||
/*
|
if me.dropdown.active || me.textbox.active {
|
||||||
// Flag widgets (dropdown menus, etc) are the highest priority. ALWAYS SEND MOUSE CLICKS THERE FIRST
|
// can't drag or do anything when dropdown or textbox are visible
|
||||||
|
log.Info("can't do anything. dropdown or textbox is active")
|
||||||
for _, tk := range findByXY(w, h) {
|
for _, tk := range findByXY(w, h) {
|
||||||
if tk.node.WidgetType == widget.Flag {
|
if tk.node.WidgetId == me.dropdown.wId {
|
||||||
tk.doWidgetClick(w, h)
|
log.Info("got dropdwon click", w, h, tk.cuiName)
|
||||||
return
|
tk.dropdownClicked(w, h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Button widgets
|
// priority widgets. send the click here first
|
||||||
for _, tk := range findByXY(w, h) {
|
for _, tk := range findByXY(w, h) {
|
||||||
if tk.node.WidgetType == widget.Button {
|
switch tk.node.WidgetType {
|
||||||
tk.doWidgetClick(w, h)
|
case widget.Button:
|
||||||
|
me.myTree.SendFromUser(tk.node)
|
||||||
return
|
return
|
||||||
|
case widget.Combobox:
|
||||||
|
tk.showDropdown()
|
||||||
|
return
|
||||||
|
case widget.Dropdown:
|
||||||
|
tk.showDropdown()
|
||||||
|
return
|
||||||
|
case widget.Textbox:
|
||||||
|
tk.showTextbox()
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
tk.dumpWidget("undef click()")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +167,7 @@ func doMouseClick(w int, h int) {
|
||||||
|
|
||||||
func doMouseDoubleClick(w int, h int) {
|
func doMouseDoubleClick(w int, h int) {
|
||||||
me.mouse.double = false
|
me.mouse.double = false
|
||||||
log.Printf("actually a double click (%d,%d)", w, h)
|
// log.Printf("actually a double click (%d,%d)", w, h)
|
||||||
|
|
||||||
for _, tk := range findByXY(w, h) {
|
for _, tk := range findByXY(w, h) {
|
||||||
if tk.node.WidgetType == widget.Window {
|
if tk.node.WidgetType == widget.Window {
|
||||||
|
|
Loading…
Reference in New Issue