On this page:
HPanel
VPanel
Group  Panel
Tabs  Panel
Tabs  Panel.at_  selection
HPanel.Style  Symbol
VPanel.Style  Symbol
Group  Panel.Style  Symbol
Tabs  Panel.Style  Symbol
8.12

5 Panels and Tabs🔗ℹ

class

class HPanel():

  implements View

  constructor (

    ~alignment: alignment :: MaybeObs.of(Alignment) = [#'center, #'top],

    ~style: style :: MaybeObs.of(List.of(HPanel.StyleSymbol)) = [],

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

    ~spacing: spacing :: MaybeObs.of(SpacingInteger) = 0,

    ~margin: margin :: MaybeObs.of(Margin) = [0, 0],

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

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

    child :: MaybeObs.of(View), ...

  )

 

class

class VPanel():

  implements View

  constructor (

    ~alignment: alignment :: MaybeObs.of(Alignment) = [#'center, #'top],

    ~style: style :: MaybeObs.of(List.of(VPanel.StyleSymbol)) = [],

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

    ~spacing: spacing :: MaybeObs.of(SpacingInteger) = 0,

    ~margin: margin :: MaybeObs.of(Margin) = [0, 0],

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

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

    child :: MaybeObs.of(View), ...

  )

Creates a panel that arranges the child views horizontally or vertically, respectively.

class

class GroupPanel():

  implements View

  constructor (

    label :: MaybeObs.of(LabelString),

    ~alignment: alignment :: MaybeObs.of(Alignment) = [#'center, #'top],

    ~style: style :: MaybeObs.of(List.of(GroupPanel.StyleSymbol)) = [],

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

    ~spacing: spacing :: MaybeObs.of(SpacingInteger) = 0,

    ~margin: margin :: MaybeObs.of(Margin) = [0, 0],

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

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

    child :: MaybeObs.of(View), ...

  )

Creates a vertical panel that shows grouping under label.

class

class TabsPanel():

  implements View

  constructor (

    choices :: MaybeObs.of(List),

    ~selection: selection :: MaybeObs.of(Any),

    ~action: action :: Function.of_arity(3) = set_selection,

    ~choice_to_label: choice_to_label :: Function.of_arity(1) = values,

    ~choice_equal: choice_equal :: Function.of_arity(2) = fun (a, b): a == b,

    ~alignment: alignment :: MaybeObs.of(Alignment) = [#'center, #'top],

    ~style: style :: MaybeObs.of(List.of(TabsPanel.StyleSymbol)) = [],

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

    ~spacing: spacing :: MaybeObs.of(SpacingInteger) = 0,

    ~margin: margin :: MaybeObs.of(Margin) = [0, 0],

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

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

    child :: MaybeObs.of(View), ...

  )

 

property

property (tabs :: TabsPanel).at_selection :: Obs

Creates a tab panel where choices provides the number and identity of choices, and selection determines which of the tabs is selected.

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 TabsPanel.at_selection property.

The choice_to_label function converts an item in choices to a label to be shown for the tab, 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.

When the tab selection changes, action is called as

action(what :: Any.of(#'select, #'new, #'close, #'reorder),

       choices :: List,

       selected :: maybe(Any))

where what describes the action, choices is the list of choices at the time of the action, and selected is the tab (if any) selected after the action. The default set_selection function corresponds to

fun (_, _, selected):

  at_selection.value := selected

To change the content of a TabsPanel based on its selection, supply a child that is an observable derived from one supplied as selection.

Satisfied by the following symbols (the same for horizontal and vertical panels):

Satisfied by the following symbols:

Satisfied by the following symbols: