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? command
Command 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? font
Font for text. Defaults to null (system default).
- imageSource
-
native Image? image
Image to display on button. Defaults to null.
- insetsSource
-
const Insets insets := defInsets
Insets 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.push
Button 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.w
will be null. If no constraints are known for height, thenhints.h
will be null. - selectedSource
-
native Bool selected
The button's selection state (if check, radio, or toggle). Defaults to false.
- textSource
-
native Str text
Text of the button. Defaults to "".