Most Motif users move a mouse in order to move the cursor from one widget to another. However, the Motif Style Guide insists that Motif applications be usable even when a mouse is not available. For that reason, most Motif applications allow users to traverse between widgets by pressing the tab key or by pressing one of the arrow keys.
If you are writing a Motif widget, then you need do very little in order to implement keyboard traversal. Code in the superclasses XmPrimitive and XmManager handle keyboard traversal for the vast majority of widgets. In order to tap into this code, the widget need only inherit the traversal translations of the appropriate superclass. To do this, simply specify XtInheritTranslations for the translations field of the PrimitiveClassPart or ManagerClassPart.
Widget writers may also wish to override the default values of two superclass resources, XmNtraversalOn and XmNnavigationType.
If the XmNtraversalOn resource is set to True (as it is by default), then traversal is activated for this widget. However, output-only widgets like ExmString should not have keyboard traversal activated. Therefore, widgets like ExmString override the default value of XmNtraversalOn, and set it to False instead.
The XmNnavigationType resource determines whether the widget is a tab group. The XmPrimitive widget establishes a default value of XmNONE for this resource. By contrast, the XmManager widget sets the default to XmTabGroup. Widget writers may want to set different defaults. (See the Motif Programmer's Guide for complete details on the various kinds of tab groups.)
The preceding suggestions tell you everything you really need to know in order to handle keyboard traversal in most widgets. However, a few specialized widgets require special care. For example, in the standard Motif widget set, the XmText widget falls into this "special care" category because it reserves the tab key and the arrow keys for purposes other than widget traversal. If you are writing a widget that falls into this category, you will not be able to inherit the traversal translations of XmPrimitive and XmManager. Instead, your widget will have to provide its own actions.