widget.Select
import "fyne.io/fyne/v2/widget"Usage
type Select
type Select struct {
DisableableWidget
// Alignment sets the text alignment of the select and its list of options.
//
// Since: 2.1
Alignment fyne.TextAlign
Selected string
Options []string
PlaceHolder string
OnChanged func(string) `json:"-"`
}Select widget has a list of options, with the current one shown, and triggers an event func when clicked
func NewSelect
func NewSelect(options []string, changed func(string)) *SelectNewSelect creates a new select widget with the set list of options and changes handler
func NewSelectWithData
func NewSelectWithData(options []string, data binding.String) *SelectNewSelectWithData returns a new select widget connected to the specified data source.
2.6func (*Select) Bind
func (s *Select) Bind(data binding.String)Bind connects the specified data source to this select. The current value will be displayed and any changes in the data will cause the widget to update.
2.6func (*Select) ClearSelected
func (s *Select) ClearSelected()ClearSelected clears the current option of the select widget. After clearing the current option, the Select widget’s PlaceHolder will be displayed.
func (*Select) CreateRenderer
func (s *Select) CreateRenderer() fyne.WidgetRendererCreateRenderer is a private method to Fyne which links this widget to its renderer
func (*Select) FocusGained
func (s *Select) FocusGained()FocusGained is called after this Select has gained focus.
func (*Select) FocusLost
func (s *Select) FocusLost()FocusLost is called after this Select has lost focus.
func (*Select) Hide
func (s *Select) Hide()Hide hides the select.
func (*Select) MinSize
func (s *Select) MinSize() fyne.SizeMinSize returns the size that this widget should not shrink below
func (*Select) MouseIn
func (s *Select) MouseIn(*desktop.MouseEvent)MouseIn is called when a desktop pointer enters the widget
func (*Select) MouseMoved
func (s *Select) MouseMoved(*desktop.MouseEvent)MouseMoved is called when a desktop pointer hovers over the widget
func (*Select) MouseOut
func (s *Select) MouseOut()MouseOut is called when a desktop pointer exits the widget
func (*Select) Move
func (s *Select) Move(pos fyne.Position)Move changes the relative position of the select.
func (*Select) Resize
func (s *Select) Resize(size fyne.Size)Resize sets a new size for a widget. Note this should not be used if the widget is being managed by a Layout within a Container.
func (*Select) SelectedIndex
func (s *Select) SelectedIndex() intSelectedIndex returns the index value of the currently selected item in Options list. It will return -1 if there is no selection.
func (*Select) SetOptions
func (s *Select) SetOptions(options []string)SetOptions updates the list of options available and refreshes the widget
2.4func (*Select) SetSelected
func (s *Select) SetSelected(text string)SetSelected sets the current option of the select widget
func (*Select) SetSelectedIndex
func (s *Select) SetSelectedIndex(index int)SetSelectedIndex will set the Selected option from the value in Options list at index position.
func (*Select) Tapped
func (s *Select) Tapped(*fyne.PointEvent)Tapped is called when a pointer tapped event is captured and triggers any tap handler
func (*Select) TypedKey
func (s *Select) TypedKey(event *fyne.KeyEvent)TypedKey is called if a key event happens while this Select is focused.
func (*Select) TypedRune
func (s *Select) TypedRune(_ rune)TypedRune is called if a text event happens while this Select is focused.
func (*Select) Unbind
func (s *Select) Unbind()Unbind disconnects any configured data source from this Select. The current value will remain at the last value of the data source.
2.6