Name
XtInstallAllAccelerators — install all accelerators from a widget and its descendants onto a destination widget.
Synopsis
void XtInstallAllAccelerators(destination, source)
Widget destination;
Widget source;
Arguments
destination
Specifies the widget in which events specified in the accelerator tables will be detected.
sourceSpecifies the root widget of the widget tree from which the actions of any descendant widget can be invoked when events occur in destination.
Description
XtInstallAllAccelerators is a convenience function for installing all accelerators from a widget and all its descendants onto one destination widget. It recursively traverses the widget tree rooted at source and installs the accelerator resource values of each widget onto destination. A common use is to call XtInstallAllAccelerators and pass the main ApplicationShell widget as the source, and the widget in which accelerator events (such as keyboard events) are to be detected as the destination. The source and destination can be the same widget.
Assuming the example shown under XtInstallAccelerators, the difference between:
XtInstallAccelerators(topLevel,box);
and
XtInstallAllAccelerators(topLevel,box);
is that in the second case, the accelerator table for box and the accelerator table for each of its descendants will be merged with the translation table of topLevel, whereas in the first case, only the accelerator table for box alone will be merged with the translation table for topLevel. In both cases, the events specified in the accelerator table or tables will be detected in topLevel.
Since topLevel is often completely hidden by the main composite or constraint widget of an application, how does it get events? Because of event propagation, a keyboard or pointer event that is not selected in a widget will propagate through that widget to the widget’s parent. (Only user events propagate.) Assuming that topLevel is an ApplicationShell widget, keyboard (or pointer) events that occur anywhere in the application will trickle down to topLevel unless selected by a child widget. This means that by installing all accelerators on topLevel with a source of box, events that occur anywhere within topLevel or within any of its descendants can trigger the accelerators and thereby invoke actions in box or any of its descendants.