wxRuby Documentation Home
ToggleButton is a button that stays pressed when clicked by the user. In
other words, it is similar to CheckBox in
functionality but looks like a Button.
You can see ToggleButton in action in the sixth page of the
controls sample.
NB: This class is not available under Universal ports such
as X11.
Derived from
Control
Window
EvtHandler
Object
Window styles
There are no special styles for ToggleButton.
See also window styles overview.
Event handling
evt_togglebutton(id) { | event | … } |
Handles a button click event. |
See also
CheckBox, Button
ToggleButton.new(%(arg-type)Window% parent, Integer id, String label,
Point pos = DEFAULT_POSITION,
Size size = DEFAULT_SIZE,
Integer style = 0,
Validator val,
String name = “checkBox”)
Constructor, creating and showing a toggle button.
Parameters
- parent Parent window. Must not be
NULL
.
- id Toggle button identifier. A value of $-1$ indicates a default value.
- label Text to be displayed next to the toggle button.
- pos Toggle button position. If the position $(-1, -1)$ is specified then a default position is chosen.
- size Toggle button size. If the default size $(-1, -1)$ is specified then a default size is chosen.
- style Window style. See ToggleButton.
- validator Window validator.
- name Window name.
See also
ToggleButton#create, Validator
destructor()
Destructor, destroying the toggle button.
Boolean create(%(arg-type)Window% parent, Integer id, String label,
Point pos = DEFAULT_POSITION,
Size size = DEFAULT_SIZE,
Integer style = 0,
Validator val,
String name = “checkBox”)
Creates the toggle button for two-step construction. See ToggleButton.new for details.
Boolean get_value()
Gets the state of the toggle button.
Return value
Returns true
if it is pressed, false
otherwise.
set_value(%(arg-type)Boolean% state)
Sets the toggle button to the given state. This does not cause a
EVT_TOGGLEBUTTON
event to be emitted.
Parameters
- state If
true
, the button is pressed.
[This page automatically generated from the Textile source at 2023-06-13 21:31:43 +0000]