Button displays a push, toggle, check, or radio button with text and/or an image. Buttons can also be used as the children of a ToolBar.
Slots
- commandSource
-
Command? commandCommand associated with this button. Setting the command automatically maps the text, icon, enable state, and eventing to the command.
-
static private Insets defInsets := ... - fontSource
-
native Font? fontFont for text. Defaults to null (system default).
- imageSource
-
native Image? imageImage to display on button. Defaults to null.
- insetsSource
-
const Insets insets := defInsetsInsets to apply for padding between the button's border and its image and text. Insets are only applied to push and toggle butttons; they are not applied to checks, radio, sep, or toolbar buttons.
- makeSource
-
new make()Default constructor.
- makeCommandSource
-
new makeCommand(Command c)Make a button the specified command.
- modeSource
-
const ButtonMode mode := ButtonMode.pushButton mode defines the style: check, push, radio, or toggle. If the button is a child of a ToolBar then you can also use sep; plus radio and toggle mean the same thing. The default is push. This field cannot be changed once the button is constructed.
- onActionSource
-
readonly EventListeners onAction := EventListeners()Callback function when button is pressed or selection is changed.
Event id fired:
Event fields:
- none
- prefSizeSource
-
override Size prefSize(Hints hints := Hints.def)Overrides fwt::Widget.prefSize
Doc inherited from fwt::Widget.prefSize
Compute the preferred size of this widget. The hints indicate constraints the widget should consider in its calculations. If no constraints are known for width, then
hints.wwill be null. If no constraints are known for height, thenhints.hwill be null. - selectedSource
-
native Bool selectedThe button's selection state (if check, radio, or toggle). Defaults to false.
- textSource
-
native Str textText of the button. Defaults to "".