Added RemoveOption() and GetOptionCount() to DropDown. Resolves #682

pull/703/head
Oliver 2 years ago
parent 1560f6b730
commit f0544de1f2

@ -267,6 +267,19 @@ func (d *DropDown) SetOptions(texts []string, selected func(text string, index i
return d
}
// GetOptionCount returns the number of options in the drop-down.
func (d *DropDown) GetOptionCount() int {
return len(d.options)
}
// RemoveOption removes the specified option from the drop-down. Panics if the
// index is out of range.
func (d *DropDown) RemoveOption(index int) *DropDown {
d.options = append(d.options[:index], d.options[index+1:]...)
d.list.RemoveItem(index)
return d
}
// SetSelectedFunc sets a handler which is called when the user changes the
// drop-down's option. This handler will be called in addition and prior to
// an option's optional individual handler. The handler is provided with the

Loading…
Cancel
Save