Type MultiSelectState

type MultiSelectState struct {
	Query  text.Editor
	Open   bool
	Active int
	// AllowCreate offers the query as a new value when no option matches it.
	AllowCreate bool
	// MatchCaseInsensitive compares values and their labels with Unicode case
	// folding, so "Development" and "development" are one value. It does not
	// control chip overflow: chips always fold into +N when the field is narrow.
	MatchCaseInsensitive bool
	Limit                int // zero means unlimited
	// validateCreate, set with SetValidateCreate, can reject a query without
	// removing its disabled create row.

	// openPainted is the popup state of the previous paint, so closing it can
	// hand focus back to a query input the popup's scope had taken.

}

MultiSelectState is application-owned selection and native query-editor state. Use SetOptions/SetValues rather than editing their slices; Choices caches its filtered rows and steady paints reuse their storage. Values remain in selection order. Query can be bound directly to the platform text service.

Methods

Choices#

func (s *MultiSelectState) Choices() []MultiSelectChoice

Choices returns filtered options, including selected custom values that no longer occur in Options. Creating never shadows an existing label or value.

Choose#

func (s *MultiSelectState) Choose(index int) bool

Choose toggles a row while keeping the popup open for further selections.

Key#

func (s *MultiSelectState) Key(event ui.KeyEvent) ui.EventResult

Key keeps keyboard navigation in the editable input. Enter chooses the first matching/create row; IME confirmation never creates a value. Tab closes the popup without consuming normal focus traversal.

Pointer#

func (s *MultiSelectState) Pointer(event ui.PointerEvent) ui.EventResult

Pointer routes a configured popup scrollbar; other presses remain ordinary clicks.

Remove#

func (s *MultiSelectState) Remove(index int) bool

SetOptions#

func (s *MultiSelectState) SetOptions(options []MultiSelectOption)

SetValidateCreate#

func (s *MultiSelectState) SetValidateCreate(validate func(string) bool)

SetValidateCreate replaces the create validator; nil accepts every query. It re-filters at the next paint, so a host that changes its rules between forms never shows a create row judged by the previous rules.

SetValues#

func (s *MultiSelectState) SetValues(values []string)

Values#

func (s *MultiSelectState) Values() []string

Values is a read-only view until the next selection change.

Wheel#

func (s *MultiSelectState) Wheel(event ui.ScrollEvent) bool