2022-10-20 06:55:42 -05:00
|
|
|
package gui
|
|
|
|
|
2023-03-12 08:47:16 -05:00
|
|
|
// functions to create 'Dropdown' and 'Combobox'
|
|
|
|
// Combobox is a Dropdown you can edit
|
|
|
|
// Thererfore, AddDropdownName() is used on both combobox and dropdown nodes
|
|
|
|
// since it is the same. confusing names? maybe...
|
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
import (
|
2024-01-13 22:02:12 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-05 13:18:44 -06:00
|
|
|
"go.wit.com/gui/widget"
|
2023-03-01 11:35:36 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
// add a new entry to the dropdown name
|
2022-11-13 08:53:03 -06:00
|
|
|
func (n *Node) AddDropdownName(name string) {
|
2024-01-13 22:02:12 -06:00
|
|
|
if ! n.Ready() { return }
|
|
|
|
log.Warn("AddDropdownName() deprecated")
|
2023-03-23 12:35:12 -05:00
|
|
|
n.AddText(name)
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
// Set the dropdown menu to 'name'
|
|
|
|
func (n *Node) SetDropdownName(name string) {
|
2024-01-13 22:02:12 -06:00
|
|
|
if ! n.Ready() { return }
|
|
|
|
log.Warn("SetDropdownName() deprecated")
|
2023-03-03 14:41:38 -06:00
|
|
|
n.SetText(name)
|
2023-02-25 14:05:25 -06:00
|
|
|
}
|
|
|
|
|
2024-01-13 22:02:12 -06:00
|
|
|
func (n *Node) NewDropdown(progname string) *Node {
|
|
|
|
newNode := n.newNode(progname, widget.Dropdown)
|
|
|
|
newNode.progname = progname
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2024-01-13 22:02:12 -06:00
|
|
|
// inform the toolkits
|
|
|
|
sendAction(newNode, widget.Add)
|
2023-03-03 14:41:38 -06:00
|
|
|
return newNode
|
|
|
|
}
|
2022-10-20 06:55:42 -05:00
|
|
|
|
2024-01-13 22:02:12 -06:00
|
|
|
func (n *Node) NewCombobox(progname string) *Node {
|
|
|
|
newNode := n.newNode(progname, widget.Combobox)
|
|
|
|
newNode.progname = progname
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2024-01-13 22:02:12 -06:00
|
|
|
// inform the toolkits
|
|
|
|
sendAction(newNode, widget.Add)
|
2022-11-13 08:53:03 -06:00
|
|
|
return newNode
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|