Widget widget;
XtPointer client_data;
XtPointer call_data;
{
Cursor cursor;
Display *display;
Widget help_widget;
XmAnyCallbackStruct *cbs, *newcbs;
XEvent *event;
cbs = (XmAnyCallbackStruct *) call_data;
display = XtDisplay (toplevel);
cursor = XCreateFontCursor (display, XC_hand2);
help_widget = XmTrackingEvent (toplevel, cursor, True, &event);
while (help_widget != NULL) {
if (XtHasCallbacks (help_widget, XmNhelpCallback) ==
XtCallbackHasSome ) {
newcbs−>reason = XmCR_HELP;
newcbs−>event = event;
XtCallCallbacks (help_widget, XmNhelpCallback,
(XtPointer) newcbs);
help_widget = NULL;
}
else
help_widget = XtParent (help_widget);
}
XFreeCursor (display, cursor);
}
When the user selects the menu item for context−sensitive help, query_for_help() is invoked. This routine calls
XmTrackingEvent() to allow the user to specify a widget on which to see help information. The confine_to
parameter is set to True, so the pointer is constrained to the window of the toplevel widget. We use toplevel
so that the user can select any component in the entire application.
XmTrackingEvent() changes the pointer to the specified cursor to provide visual feedback that the application is
in a new state. Since the user is expected to click on a object, the routine uses the XC_hand2 glyph that shows a
pointing hand. The cursor is created using XCreateFontCursor(). See Volume One, Xlib Programming
Manual, for more information.
If the user clicks on any valid widget within the application, XmTrackingEvent() returns ...