off_action is name of the actions object associated with the toggle. When the toggle is selected and its state toggles to off, a tick! message will be sent to the actions object.
on_action is name of the actions object associated with the toggle. When the toggle is selected and its state toggles to on, a tick! message will be sent to the actions object.
state indicates whether the toggle is on or off. The state will be set to 1 for on or 0 for off.
label? returns the value of the label instance variable.
label= sets the value of the label instance variable.
off_action? returns the value of the off_action instance variable.
off_action= sets the value of the off_action instance variable.
on_action? returns the value of the on_action instance variable.
on_action= sets the value of the on_action instance variable.
state? returns the value of the state instance variable.
state= sets the value of the state instance variable.
toggle_off sets the toggle's state to off and sends a tick! message to the on_action.
toggle_on sets the toggle's state to on and sends a tick! message to the on_action.
ui create!;
ui_control_panel new: my_panel parent= ui create! ;
/* create toggle and it actions */ ui_toggle new: toggle parent= my_panel label= "toggle label" on_action= on_action off_action= off_action create! ;
actions new: on_action tick_actions= `! toggle is on...';
actions new: off_action tick_actions= `! toggle is off...';
/* add exit button */
ui_button new: ebutton parent= my_panel label= "exit" action= bye_bye create! @ x : 70 @ y : 30;
actions new: bye_bye tick_actions= "ui exit!";
/* run it! */
ui on! start!;