new-gui/dropdown.go

44 lines
1.0 KiB
Go

package gui
// 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...
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(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(progname string) *Node {
newNode := n.newNode(progname, widget.Combobox)
newNode.progname = progname
// inform the toolkits
sendAction(newNode, widget.Add)
return newNode
}