Gadgets provide essentially the same functionality as the equivalent primitive widgets. They are more efficient in execution time and data space. This performance improvement is so dramatic that applications should use gadgets in place of widgets where ever possible.
NOTE: Since gadgets don't have windows, requests for window id's are reported as errors. Also, gadgets must have a parent that is a widget, .i.e. the parent must have a window.
For a more complete description of this Motif widget, consult "OSF/Motif Programmer's Reference."
disarm_action is an action that is executed when mouse button 1 is released.
value_changed_action is an action that is executed when the toggle button is pressed and released.
: value sets the current resource to value. Since most resources have mixed case, you should enclose any resource name in quotes. Resource names are the Motif names with the XmN prefix removed. Some resources can only be set before the widget is created. For efficiency, set as many resources as you can before creation.
scalar_value? returns the value of the current resource whose
type is integer.
string_value? returns the value of the current resource whose type is string.
pointer_value? returns the value of the current resource whose type is a pointer of any kind.
create! creates an instance of the widget. Any resources that have been specified prior to the create! will be set. An id? message also sends a create!.
on! realizes the widget. Realizing a widget creates its windows and displays it when it is managed.
<motifinit <colors
motif application= "Toggle Button Example";
motif_row_column new: control parent=motif ;
! gadgets do not have separate windows, so the current widget will always be ! the control object
motif_toggle_button_gadget new: button1 parent=control arm_action=`on' create! ; motif_toggle_button_gadget new: button2 parent=control arm_action=`on' create! ; motif_toggle_button_gadget new: button3 parent=control arm_action=`on' create! ; motif_toggle_button_gadget new: button4 parent=control arm_action=`on'
create! ; motif_toggle_button_gadget new: button5 parent=control arm_action=`on' create! ;
actions new: `on' tick_actions=`motif print:current_widget;';
motif on! start!;