
|
class gui.Choice(): | implements WindowChildView | constructor ( | choices :: ObsOrValue.of(List), | ~choice_to_label: choice_to_label :: Any -> Any = values, | ~choice_equal: choice_equal :: Function.of_arity(2) = (_ == _), | ~selection: selection :: ObsOrValue.of(Any) = #false, | ~action: action :: Any -> ~any = values, | ~label: label :: ObsOrValue.of(maybe(View.LabelString)) = #false, | ~styles: styles :: List.of(Choice.Style) = [], | ~enable: enable :: ObsOrValue.of(Boolean) = #true, | ~margin: margin :: ObsOrValue.of(View.Margin) = [2, 2], | ~min_size: min_size :: ObsOrValue.of(Size) = [#false, #false], | ~stretch: stretch :: ObsOrValue.of(Stretch) = [#true, #true], | ~window_callbacks: window_callbacks :: maybe(WindowCallbacks) = #false | ) |
|
|
|
|
Creates a popup choice selector where choices provides the
number and identity of choices, and selection determines which
of the tabs is selected. When rendered, the function call
action(now_selected) is performed when the
selection is changed, where now_selected indicates the
newly selected choice.
The Choice.at_selection property returns an observable that
is updated whenever the choice popup’s state changes through an action
(as also reported via action) or via selection as an
observable.
The choice_to_label function converts an item in
choices to a label to be shown for the control, and
choice_equal defines equality for choice identities. By
default, choices is expected to be a list of
View.LabelString, since choice_to_label is the identity
function.
A choice control style option:
#'horizontal_label: When the choice control has a
label, show it to the left of the control. Horizontal label placement is
the default if #'vertical_label is not specified, and
#'horizontal_label and #'vertical_label are mutually
exclusive.
#'vertical_label: When the choice control has a
label, show it above the control.