API 文档由 Go 源码生成,内容为英文。
type SegmentedControl struct {
// tabStop is the one segment Tab reaches; arrows move among the others.
}
SegmentedControl paints a compact, neutral choice group. It retains no
state: selection belongs to the application and every paint reads transient
pointer and focus state from the canvas.
构造函数
BeginSegmentedControl#
func BeginSegmentedControl(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, options []SegmentOption, selected ui.ID) SegmentedControl
BeginSegmentedControl starts a segmented choice declaration. Each enabled,
non-zero option ID becomes an independently focusable hit. The runtime's
existing hit routing therefore activates the focused option with Enter or
Space.
方法
Disabled#
func (control SegmentedControl) Disabled() SegmentedControl
Disabled renders the complete control as inert.
Paint#
func (control SegmentedControl) Paint() SegmentedControlResult
Paint draws the track, one stable surface command per option, separators,
labels, and hit regions. Stable option order keeps retained scene identities
unchanged while hover, press, and selection only update command values. Each
option's hit is a radio (checked when selected), disabled ones included.