Rhombus

|
class gui.Input(): | implements WindowChildView | constructor ( | content :: ObsOrValue.of(Any), | ~action: action :: maybe((Input.Event, String) -> ~any) = #false, | ~label: label :: ObsOrValue.of(View.LabelString) = "", | ~choices: choices :: maybe(ObsOrValue.of(List.of(View.LabelString))) | = #false, | ~enable: enable :: ObsOrValue.of(Boolean) = #true, | ~background_color: bg_color :: ObsOrValue.of(maybe(Color)) = #false, | ~styles: styles :: List.of(Input.StyleSymbol) = [#'single], | ~font : font :: draw.Font = View.normal_control_font, | ~margin: margin :: ObsOrValue.of(View.Margin) = [2, 2], | ~min_size: min_size :: ObsOrValue.of(View.Size) = [#false, #false], | ~stretch: stretch :: ObsOrValue.of(View.Stretch) = [#true, #true], | ~window_callbacks: window_callbacks :: maybe(WindowCallbacks) = #false, | ~is_equal_value: is_equal :: Function.of_arity(2) = (_ == _), | ~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.
If the ~choices argument is not #false, it provides
a list of suggestions via a popup menu. When a user selects an item in
the popup menu, it is copied into 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.
The Input.at_content property returns an observable that
is updated whenever the input’s value changes through an action
(as also reported via action) or via content as an
observable.
An input style option.
An event provided to the
~action callback function of an
Input. The event
#'input corresponds to any
change to the input text, while
#'return indicates that the
Return or Enter key was pressed. The
#'focus_in and
#'focus_out events report keyboard-focus changes.