diff options
| author | Jeff Carr <[email protected]> | 2024-01-13 22:02:12 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-13 22:02:12 -0600 |
| commit | 47b15946de10a75cda026a7317a90d4857b453c8 (patch) | |
| tree | ab6a8c085226263982d3b19f2913e540707af2a1 /dropdown.go | |
| parent | 4ef8409eeadcd4a359b7593b5ea35f9f523bfb64 (diff) | |
work on hiding widgetsv0.12.5
When widgets are hidden, their state works exactly the same
as normal, but updates are not sent to the toolkits
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'dropdown.go')
| -rw-r--r-- | dropdown.go | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/dropdown.go b/dropdown.go index 03479bb3..9b65154 100644 --- a/dropdown.go +++ b/dropdown.go @@ -6,41 +6,38 @@ package gui // since it is the same. confusing names? maybe... import ( + "go.wit.com/log" "go.wit.com/gui/widget" ) // add a new entry to the dropdown name func (n *Node) AddDropdownName(name string) { + if ! n.Ready() { return } + log.Warn("AddDropdownName() deprecated") n.AddText(name) } // Set the dropdown menu to 'name' func (n *Node) SetDropdownName(name string) { + if ! n.Ready() { return } + log.Warn("SetDropdownName() deprecated") n.SetText(name) } -func (n *Node) NewDropdown(name string) *Node { - newNode := n.newNode(name, widget.Dropdown) - newNode.progname = name - newNode.value = name - - if ! newNode.hidden { - a := newAction(newNode, widget.Add) - sendAction(a) - } +func (n *Node) NewDropdown(progname string) *Node { + newNode := n.newNode(progname, widget.Dropdown) + newNode.progname = progname + // inform the toolkits + sendAction(newNode, widget.Add) return newNode } -func (n *Node) NewCombobox(name string) *Node { - newNode := n.newNode(name, widget.Combobox) - newNode.progname = name - newNode.value = name - - if ! newNode.hidden { - a := newAction(newNode, widget.Add) - sendAction(a) - } +func (n *Node) NewCombobox(progname string) *Node { + newNode := n.newNode(progname, widget.Combobox) + newNode.progname = progname + // inform the toolkits + sendAction(newNode, widget.Add) return newNode } |
