3.3.5 Controls
3.3.5.1 Button
3.3.5.2 Checkbox
3.3.5.3 Choice
3.3.5.4 Radio  Choice
3.3.5.5 List  Choice
3.3.5.6 Table
3.3.5.7 Slider
3.3.5.8 Progress
3.3.5.9 Input
3.3.5.10 Label
3.3.5.11 Image
3.3.5.12 Spacer
On this page:
Button
Button.Style
Button.Style.default
Button.Style.multi_  line
Button.Label  Position
Button.Label  Position.left
Button.Label  Position.top
Button.Label  Position.right
Button.Label  Position.bottom

image

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,

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

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

    ~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) = [#false, #false],

    ~window_callbacks: window_callbacks :: maybe(WindowCallbacks) = #false

  )

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

enumeration

enum gui.Button.Style

| default

| multi_line

A button style option:

  • #'default: The button is the default action, especially in a Dialog where the Return key automatically has the effect of clicking a default button.

  • #'multi_line: Newline characters in the button’s label can create a line break in the button’s label.

enumeration

enum gui.Button.LabelPosition

| left

| top

| right

| bottom

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