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,

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

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

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

  )

Creates a button. Buttons with bitmap labels (or a combination of bitmap and text) tend to have a different style than buttons with text labels. See View.LabelString for information about keyboard mnemonics in label.

The action function is called when the button is clicked by a user.

See Geometry Management for information about ~margin, ~min_size, and ~stretch.

The ~window_callbacks argument configures callbacks that are common to all WindowChildViews. See WindowCallbacks for more information.

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.