Skip to Main Content
Volume 6A: Motif Programming Manual
book

Volume 6A: Motif Programming Manual

by David Brennan, Dan Heller, Paula Ferguson
September 1993
Intermediate to advanced content levelIntermediate to advanced
1014 pages
28h 26m
English
O'Reilly Media, Inc.
Content preview from Volume 6A: Motif Programming Manual
/* cb.uil − Plain and simple callback setting example. */
module cb
procedure
print (string);
quit();
object Hello : XmPushButton {
callbacks {
XmNactivateCallback = procedure print ("hello!");
};
};
object Goodbye : XmPushButton {
callbacks {
XmNactivateCallback = procedures {
print ("goodbye!");
quit();
};
};
};
object root : XmRowColumn {
controls {
XmPushButton Hello;
XmPushButton Goodbye;
};
};
end module;
The callback declarations in the procedure section tell the UIL compiler that the procedures are defined externally
in the application program. A callback setting looks similar to a resource setting; it always begins with the name of a
callback, such as XmNactivateCallback, and is followed by an equal sign. The right−hand side of the setting
varies depending on the number of callback procedures you are specifying. A single callback is specified with the
keyword procedure followed by the callback invocation. Multiple callbacks are specified with the keyword
procedures followed by a list of callback invocations.
In the source code the XmNactivateCallback of the Hello PushButton is set to the single callback procedure
print(), while the XmNactivateCallback of the Goodbye PushButton is set to the two callbacks print()
and quit(). You cannot specify multiple callbacks by setting the same callback more than once because when you
set the same resource or callback multiple times, only the last setting is used. The Xt specification doesn't guarantee
the order in which callbacks are called, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 7A: XView Programming Manual

Volume 7A: XView Programming Manual

Dan Heller

Publisher Resources

ISBN: 9780596000431