Clicked#
func (result SegmentedControlResult) Clicked() (ui.ID, bool)Clicked returns the option whose click this paint is delivering, and false in every other paint (see ui.Canvas.Clicked), so the code that declares the control is the code that changes the selection:
if id, ok := components.BeginSegmentedControl(canvas, theme, bounds, options, selected).Paint().Clicked(); ok {
selected = id
}