On this page:
Button
Checkbox
Checkbox.at_  is_  checked
Choice
Choice.at_  selection
Radio  Choice
Radio  Choice.at_  selection
List  Choice
List  Choice.at_  selection
Table
Table.at_  selection
Slider
Slider.at_  value
Progress
Progress.at_  value
Label
Label.at_  label
Image
Input
Input.at_  content
Spacer
Button.Style
Button.Style.border
Button.Style.multi_  line
Button.Style.deleted
Button.Label  Position
Button.Label  Position.left
Button.Label  Position.top
Button.Label  Position.right
Button.Label  Position.bottom
Choice.Style
Choice.Style.horizontal_  label
Choice.Style.vertical_  label
Choice.Style.deleted
Radio  Choice.Style
Radio  Choice.Style.vertical
Radio  Choice.Style.horizontal
Radio  Choice.Style.horizontal_  label
Radio  Choice.Style.vertical_  label
Radio  Choice.Style.deleted
List  Choice.Style  Symbol
List  Choice.Style  Symbol.horizontal_  label
List  Choice.Style  Symbol.vertical_  label
List  Choice.Style  Symbol.deleted
Table.Style  Symbol
Table.Style  Symbol.single
Table.Style  Symbol.multiple
Table.Style  Symbol.extended
Table.Style  Symbol.variable_  columns
Table.Style  Symbol.column_  headers
Table.Style  Symbol.clickable_  headers
Table.Style  Symbol.reorderable_  headers
Table.Style  Symbol.horizontal_  label
Table.Style  Symbol.vertical_  label
Table.Style  Symbol.deleted
Table.Event
Table.Event.select
Table.Event.double_  click
Table.Event.column
Table.Selection
Slider.Style
Slider.Style.horizontal
Slider.Style.vertical
Slider.Style.plain
Slider.Style.horizontal_  label
Slider.Style.vertical_  label
Slider.Style.deleted
Progress.Style
Progress.Style.horizontal
Progress.Style.vertical
Progress.Style.horizontal_  label
Progress.Style.vertical_  label
Progress.Style.deleted
Input.Style  Symbol
Input.Style  Symbol.deleted
Input.Style  Symbol.horizontal_  label
Input.Style  Symbol.hscroll
Input.Style  Symbol.multiple
Input.Style  Symbol.password
Input.Style  Symbol.single
Input.Style  Symbol.vertical_  label
Input.Event
Input.Event.input
Input.Event.return
Input.Event.focus_  in
Input.Event.focus_  out
Image.Display  Mode
Image.Display  Mode.fit
Image.Display  Mode.fill
0.45+9.1.0.3

7 Controls🔗ℹ

class

class gui.Button():

  implements WindowChildView

  constructor (

    label :: ObsOrValue.of(View.LabelString

                             || draw.Bitmap

                             || [draw.Bitmap,

                                 View.LabelString,

                                 Button.LabelPosition]),

    ~action: action :: () -> ~any = fun (): #void,

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~styles: styles :: ObsOrValue.of(List.of(Button.Style)) = [],

    ~margin: margin :: ObsOrValue.of(View.Margin) = [2, 2],

    ~min_size: min_size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~stretch: stretch :: ObsOrValue.of(View.Stretch) = [#false, #false]

  )

Creates a button. When rendered, the function call action() is performed when the button is clicked.

class

class gui.Checkbox():

  implements WindowChildView

  constructor (

    label :: ObsOrValue.of(View.LabelString),

    ~is_checked: is_checked :: ObsOrValue.of(Boolean) = #false,

    ~action: action :: Boolean -> ~any = values,

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~margin: margin :: ObsOrValue.of(View.Margin) = [2, 2],

    ~min_size: min_size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~stretch: stretch :: ObsOrValue.of(View.Stretch) = [#false, #false]

  )

 

property

property (cb :: gui.Checkbox).at_is_checked :: Obs.of(Boolean)

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.

The Checkbox.at_is_checked property returns an observable that is updated whenever the checkbox’s state changes through an action (as also reported via action) or via is_checked as an observable.

class

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 :: ObsOrValue.of(List.of(Choice.Style)) = [],

    ~is_enabled: is_enabled :: 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]

  )

 

property

property (chc :: gui.Choice).at_selection :: Obs

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.

class

class gui.RadioChoice():

  implements WindowChildView

  constructor (

    choices :: List.of(String),

    ~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 :: ObsOrValue.of(List.of(RadioChoice.Style))

               = [#'vertical],

    ~is_enabled: is_enabled :: 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]

  )

 

property

property (chc :: gui.RadioChoice).at_selection :: Obs

Like gui.Choice, but presented as radio buttons instead of a popup menu. Unlike gui.Choice, the choices list cannot be changed.

The styles list must include either #'vertical or #'horizontal.

class

class gui.ListChoice():

  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 :: ObsOrValue.of(List.of(ListChoice.StyleSymbol)) = [],

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~font : font :: draw.Font = normal_control_font,

    ~margin: margin :: ObsOrValue.of(View.Margin) = [2, 2],

    ~min_size: min_size :: ObsOrValue.of(Size) = [#false, #false],

    ~stretch: stretch :: ObsOrValue.of(Stretch) = [#true, #true]

  )

 

property

property (chc :: gui.ListChoice).at_selection :: Obs

Like gui.Choice, but presented as a list box instead of a popup menu. The ListChoice view is a simplified version of the Table view.

class

class gui.Table():

  implements WindowChildView

  constructor (

    columns :: List.of(View.LabelString),

    choices :: ObsOrValue.of(Array),

    ~action: action :: (Table.Event, Array, Table.Selection) -> ~any

               = values,

    ~choice_to_row: choice_to_row :: Any -> Array.now_of(View.LabelString)

                      = values,

    ~selection: selection :: ObsOrValue.of(Table.Selection) = #false,

    ~label: label :: ObsOrValue.of(View.LabelString) = "",

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~style: style :: ObsOrValue.of(List.of(Table.StyleSymbol))

              = [#'single, #'column_headers,

                 #'clickable_headers, #'reorderable_headers],

    ~font : font :: Font = 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, #false],

    ~column_widths: column_widths :: ObsOrValue.of(List.of(Table.CellWidth))

                      = []

  )

 

property

property (chc :: gui.Table).at_selection :: Obs

Creates a list-row selector where choices provides column labels (and, implicitly, the column column), choices provides the number and identity of rows, and selection determines which of the lines are selected. When rendered, the function call action(event, choices, selection) is performed when the table is changed, where event indicates the kind of action, choices indicates the choices at the time of the event, and choice selection identifies the selected rows.

The Table.at_selection property returns an observable that is updated whenever the table’s selection state changes through an action (as also reported via action) or via selection as an observable.

The choice_to_row function converts an element of choices to an array of label strings to show in the table.

The style list must contain exactly one of single, #'multiple, and #'extended.

class

class gui.Slider():

  implements WindowChildView

  constructor (

    ~label: label :: ObsOrValue.of(maybe(View.LabelString)) = #false,

    ~value: value :: ObsOrValue.of(View.PositionInt) = 0,

    ~min_value: min_value :: ObsOrValue.of(View.PositionInt) = 0,

    ~max_value: max_value :: ObsOrValue.of(View.PositionInt) = 100,

    ~action: action :: View.PositionInt -> ~any = values,

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~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],

    ~styles: styles :: List.of(Slider.Style) = [#'horizontal]

  )

 

property

property (sldr :: gui.Slider).at_value :: Obs.of(PositionInt)

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.

The Slider.at_value property returns an observable that is updated whenever the slider’s value changes through an action (as also reported via action) or via value as an observable.

The styles list must include one of #'horiziontal and #'vertical.

class

class gui.Progress():

  implements WindowChildView

  constructor (

    value :: ObsOrValue.of(View.SizeInt) = 0,

    ~label: label :: ObsOrValue.of(maybe(View.LabelString)) = #false,

    ~max_value: max_value :: ObsOrValue.of(View.PosSizeInt) = 100,

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~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],

    ~styles: styles :: List.of(Progress.Style) = [#'horizontal]

  )

 

property

property (prog :: gui.Progress).at_value :: Obs.of(SizeInt)

Creates a read-only (from the user’s perspective) progress gauge that show value out of max_value progress.

The styles list must include one of #'horiziontal and #'vertical.

The Progress.at_value property returns an observable that is updated whenever the progress gauge’s state changes through value as an observable.

class

class gui.Label():

  implements WindowChildView

  constructor (

    label :: ObsOrValue.of(View.LabelString),

    ~color: color :: ObsOrValue.of(maybe(Color)) = #false,

    ~font: font :: ObsOrValue.of(Font) = Label.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],

    ~styles: styles :: List.of(Progress.Style) = [#'horizontal]

  )

 

property

property (lbl :: gui.Label).at_label :: Obs.of(View.LabelString)

Creates a text label.

The Label.at_label property returns an observable that is updated whenever the label’s state changes through label as an observable.

class

class gui.Image():

  implements WindowChildView

  constructor (

    content :: ObsOrValue.of(PathString || draw.Bitmap),

    ~size: size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~display: display :: ObsOrValue.of(Image.DisplayMode) = #'fit,

    ~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]

  )

Creates a bitmap image display showing either a draw.Bitmap instance or one that is loaded from a specified file path.

When size has #false for a dimension, then the size of content is used. Within that size, the image is either scaled to fit in both dimensions when display is #'fit, or it is stretched to fill in both dimensions when display is #'fill.

If the image view has a different size based on min_size and stretch, then the image is centered within the view’s area.

class

class gui.Input():

  implements WindowChildView

  constructor (

    content :: ObsOrValue.of(Any),

    ~action: action :: maybe((Input.Event, String) -> ~any) = #false,

    ~label: label :: ObsOrValue.of(View.LabelString) = "",

    ~is_enabled: is_enabled :: ObsOrValue.of(Boolean) = #true,

    ~background_color: bg_color :: ObsOrValue.of(maybe(Color)) = #false,

    ~styles: styles :: ObsOrValue.of(List.of(Input.Style)) = [#'single],

    ~font : font :: Font = 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],

    ~is_equal_value: is_equal :: Function.of_arity(2) = (_ == _),

    ~value_to_text: val_to_txt :: Function = values

  )

 

property

property (inp :: gui.Input).at_content :: Obs.of(Any)

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.

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.

class

class gui.Spacer():

  implements WindowChildView

  constructor (

    ~min_size: min_size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~stretch: stretch :: ObsOrValue.of(View.Stretch) = [#true, #true]

  )

Returns a representation of a spacer. By default, spacers extend to fill the space of their parents.

enumeration

enum gui.Button.Style

| border

| multi_line

| deleted

A button style option.

enumeration

enum gui.Button.LabelPosition

| left

| top

| right

| bottom

A button label-position option for text combined with an image.

A choice control style option.

A RadioChoice control style option.

A ListChoice control style option.

A Table control style option.

enumeration

enum gui.Table.Event

| select

| double_click

| column

An event provided to the ~action callback function of an Table. A #'select event reports a change in the selection, #'double_click reports a double click, and #'column indicates a chagne in column order.

annotation

gui.Table.Selection

Equivalent to maybe(Int || List.of(Int)) to represent a Table selection.

A slider style option.

A slider style option.

An input style option.

enumeration

enum gui.Input.Event

| input

| return

| focus_in

| focus_out

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.

enumeration

enum Image.DisplayMode

| fit

| fill

Scaling options for Image.