8.16.0.4
|
class Button(): | implements View | constructor ( | label :: MaybeObs.of(LabelString | || Bitmap | || matching([_ :: Bitmap, | _ :: LabelString, | _ :: Button.LabelPosition])), | ~action: action :: Function.of_arity(0) = fun (): #void, | ~is_enabled: is_enabled :: MaybeObs.of(Boolean) = #true, | ~styles: styles :: MaybeObs.of(List.of(Button.Style)) = [], | ~margin: margin :: MaybeObs.of(Margin) = [0, 0], | ~min_size: min_size :: MaybeObs.of(Size) = [#false, #false], | ~stretch: stretch :: MaybeObs.of(Stretch) = [#true, #true], | ) |
|
Creates a button. When rendered, the function call action()
is performed when the button is clicked.
Creates a checkbox. When rendered, the function call
action(now_checked) is performed when the
checkbox is clicked, where now_checked indicates the
state of the checkbox.
If is_checked is not an observable, then an observable
at_is_checked is created with initial value
is_checked. Otherwise, at_is_checked is
is_checked. A observable derived from
at_is_checked can be obtained from the
Checkbox.at_is_checked property.
The default set_is_checked function for action
corresponds to
fun (on): |
at_is_checked.value := on |
|
class Choice(): | implements View | constructor ( | choices :: MaybeObs.of(List), | ~choice_to_label: choice_to_label :: Function.of_arity(1) = values, | ~choice_equal: choice_equal :: Function.of_arity(2) = (_ == _), | ~selection: selection :: MaybeObs.of(Any) = #false, | ~action: action :: maybe(Function.of_arity(1)) = #false, | ~label: label :: MaybeObs.of(maybe(LabelString)) = #false, | ~styles: styles :: MaybeObs.of(List.of(Choice.Style)) = [], | ~is_enabled: is_enabled :: MaybeObs.of(Boolean) = #true, | ~min_size: min_size :: MaybeObs.of(Size) = [#false, #false], | ~stretch: stretch :: MaybeObs.of(Stretch) = [#true, #true], | ) |
|
|
|
|
Creates a popup choice selecotr 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.
If selection is not an observable, then an observable
at_selection is created with initial value
selection. Otherwise, at_selection is
selection. A observable derived from
at_selection can be obtained from the
Choice.at_selection property.
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
LabelString, since choice_to_label is the identity
function.
The default action function corresponds to
fun (selected): |
at_selection.value := selected |
|
class Slider(): | implements View | constructor ( | label :: MaybeObs.of(maybe(LabelString)) = #false, | ~value: value :: MaybeObs.of(PositionInteger) = 0, | ~min_value: min_value :: MaybeObs.of(PositionInteger) = 0, | ~max_value: max_value :: MaybeObs.of(PositionInteger) = 100, | ~action: action :: maybe(Function.of_arity(1)) = #false, | ~is_enabled: is_enabled :: MaybeObs.of(Boolean) = #true, | ~min_size: min_size :: MaybeObs.of(Size) = [#false, #false], | ~stretch: stretch :: MaybeObs.of(Stretch) = [#true, #true], | ~styles: styles :: List.of(Slider.Style) = [#'horizontal], | ) |
|
|
|
|
Creates a slider. When rendered, the function call
action(now_val) is performed when the
slider is changed, where now_val indicates the value of
the slider.
If value is not an observable, then an observable
at_value is created with initial value
value. Otherwise, at_value is
value. A observable derived from
at_value can be obtained from the
Checkbox.at_value property.
The default set_value function for action
corresponds to
fun (val): |
at_value.value := val |
Creates a text label.
If label is not an observable, then an observable
at_label is created with initial value
value. Otherwise, at_label is
value. A observable derived from
at_value can be obtained from the
Label.at_label property.
|
class Input(): | implements View | constructor ( | content :: MaybeObs.of(Any), | ~action: action :: maybe(Function.of_arity(2)) = #false, | ~label: label :: MaybeObs.of(LabelString) = "", | ~is_enabled: is_enabled :: MaybeObs.of(Boolean) = #true, | ~background_color: bg_color :: MaybeObs.of(maybe(Color)) = #false, | ~styles: styles :: MaybeObs.of(List.of(Input.Style)) = [#'single], | ~font : font :: Font = normal_control_font, | ~margin: margin :: MaybeObs.of(Margin) = [0, 0], | ~min_size: min_size :: MaybeObs.of(Size) = [#false, #false], | ~stretch: stretch :: MaybeObs.of(Stretch) = [#true, #true], | ~mixin: mixin :: Function = values, | ~is_equal_value: is_equal :: maybe(Function.of_arity(2)) = (fun (a, b): a == b), | ~value_to_text: val_to_txt :: Function = values | ) |
|
Returns a representation of a text field that calls action on change.
The first argument to the action is the type of event that caused
the input to change and the second is the contents of the text field.
The ~is_equal_value argument controls when changes to the input data
are reflected in the contents of the field. The contents of the input field only
change when the new value of the underlying observable is not == to the
previous one. The only exception to this is when the textual value
(via ~value_to_text) of the observable is the empty string, in which case
the input is cleared regardless of the value of the underlying observable.
The ~value_to_text argument controls how the input values are rendered
to strings. If not provided, value must be either a string? or an observable
of strings.
Returns a representation of a spacer. Spacers extend to fill the
space of their parents.
A button style option.
A button label-position option for text combined with an image.
A choice control style option.
A slider style option.
An input style option.