Motif Callback Parameters
For any Widget Toolbox callback under Motif, the first five parameters are always the same; however, some widget classes require additional callback parameters. These required and additional parameters are described below.
 
note
The callback parameters described below are only used with Widget Toolbox functions. Wave Widgets users do not need to use this appendix.
 
note
Rogue Wave has ported a subset of the Widget Toolbox (Wt) functionality that is available for Motif to Microsoft Windows. Because the Widget Toolbox under Windows is not a complete implementation, we recommend that Windows developers use the PV-WAVE 10.0 Widgets (Ww) layer or the VDA Tools when developing GUI applications.
Required Callback Parameters
The callback routines for all Motif widgets must have the following five parameters. The only exception to this is when the Noparams keyword is used in the WtCreate function. When this keyword is used, callbacks need only two parameters, the widget and data. All callback parameters are read-only.
*widget—The widget ID.
*data—Client data passed to WtAddCallback.
*nparams—The number of callback parameters after nparams. Two are required: reason and event.
*reason—Callback reason (For example: Xm_CR...).
*event—XEvent structure. This structure contains the tag fields documented in Appendix E, “Event Reference”, of the Xlib Reference Manual, Volume 2, (O’Reilly & Associates, Inc., 1989) and an event tag, which contains the address of the XEvent structure.
See the OSF/Motif Programmer's Reference for more information on callback parameters.
Additional Required Callback Parameters
This section lists additional required callback parameters for the Motif widget classes.
 
note
Callbacks for the XbaeMatrix (table) widget and XvnPreview widget are discussed in supplemental XbaeMatrix and XvnPreview documentation, which you can find in the following files:
<wavedir>/docs/widgets/matrix_motif.ps 
<wavedir>/docs/widgets/preview_motif.ps
Where <wavedir> is the main PV‑WAVE directory.
You can print these files on any PostScript printer.
ArrowButton
*click_count—Number of clicks. Only specified if the callback reason is XmCR_ACTIVATE. See the OSF/Motif Programmer’s Reference for more information.
Command
*command—A string containing the last command entered.
*length—Length of the command.
DrawingArea
*window—Window ID of the drawing area.
DrawnButton
*window—Window ID of the drawn button.
*click_count—Number of clicks. Only specified if the callback reason is XmCR_ACTIVATE. See the OSF/Motif Programmer’s Reference for more information.
FileSelection
*filespec—A string containing the file specification.
*filespeclen—File specification length.
*mask—A string containing the directory/file mask.
*masklen—The directory/file mask length.
*dir—A string containing the directory.
*dirlen—Directory length.
*pattern—A string containing the file search pattern.
*patternlen—The file search pattern length.
List
*item—A string containing the last selected item.
*itemlen—The last selected item length.
*position—Position of the last selected item (for callback reasons XmCR_MULTIPLE_SELECT and XmCR_EXTENDED_SELECT).
*count—Number of selected items.
*selected_items—An array of strings containing selected items.
*positions—An array of long integers specifying positions of the selected items.
*selectiontype—Type of selection (XmINITIAL, XmMODIFICATION, XmADDITION).
PushButton
*click_count—Number of clicks. Only specified if the callback reason is XmCR_ACTIVATE. See the OSF/Motif Programmer’s Reference for more information.
RowColumn
The following parameters are only used only if the callback reason is XmCR_ACTIVATE.
*widget—Widget ID of the selected RowColumn item.
*button—Button number of the selected button.
*click_count—Number of clicks. For more information, see the OSF/Motif Programmer’s Reference.
Scale
*value—New slider value.
ScrollBar
*value—New slider value.
*pixelX-coordinate of the mouse button for horizontal direction; y-coordinate of the mouse button for vertical direction. Used only for the XmCR_TO_BOTTOM and Xm_CR_TO_TOP callback reasons.
Selection
*selection—A string containing the selection.
*selectionlen—Selected string length.
Text, TextField
For the callback reasons XmCR_LOSING_FOCUS, XmCR_MODIFYING_TEXT_VALUE, XmCR_MOVING_INSERT_CURSOR:
*doit—Return value indicating if action is performed—must be declared as a long (e.g.: doit = OL).
*currInsert—Current position of insert cursor.
*newInsert—New position of insert cursor.
For the callback reasons XmCR_MODIFYING_TEXT_VALUE,
XmCR_MOVING_INSERT_CURSOR:
*startPos—Starting position of the text to modify.
*endPos—Ending position of the text to modify.
For the callback reason XmCR_MODIFYING_TEXT_VALUE:
*text—A string containing the text to be inserted.
*textlen—Text length.
*format—Format of the text.
ToggleButton
*value—The toggle button’s current state.