[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]
Motif 2.1 Widget Writer's Guide
XmeAddFocusChangeCallback
Registers a callback for focus changes
Format
#include
<Xm/VendorSEP.h>
void XmeAddFocusChangeCallback
Widget
widgetXtCallbackProc
callback_procedureXtPointer
data
DESCRIPTION
XmeAddFocusChangeCallback registers a callback_procedure to be
called whenever there is a focus change to any widget in the widget tree
managed by a specified VendorShell or subclass of VendorShell. This
callback_procedure is called the focus change callback. Motif will
not call the focus change callbacks when the VendorShell (or subclass) is in
implicit mode. In explicit mode, Motif automatically calls the focus change
callbacks whenever the user or the application attempts to change focus. Your
focus change callback procedure has the option of accepting or rejecting the
attempted focus change.
Registering a focus change callback can cause an entire application to run
more slowly because the focus change callbacks might be called fairly
frequently.
A focus change callback can be removed by calling
XmeRemoveFocusChangeCallback.
widgetSpecifies the widget whose children are to be monitored for focus changes.
The specified widget must be a VendorShell or a subclass of
VendorShell.
callback_procedureSpecifies the callback procedure to be called whenever there is a focus
change.
dataSpecifies the call data to be passed as the call_data argument to
the callback procedure.
Motif passes a pointer to an XmFocusMovedCallbackStruct to
callback_procedure. When callback_procedure returns, Motif
examines the cont field only.
typedef struct {
int
reason ;
XEvent *
event;
Boolean
cont;
Widget
old_focus;
Widget
new_focus;
unsigned char
focus_policy;
XmTraversalDirection
direction;
} XmFocusMovedCallbackStruct;
reasonIndicates why the callback was invoked. Motif always sets this field to
XmCR_FOCUS_MOVED.
eventPoints to the event that triggered the callback.
contIndicates whether an attempted focus change will be allowed or rejected. A
focus change callback should set cont to True (the default) to permit
the focus change. A focus change callback should set cont to False to
reject the focus change. Therefore, if you set cont to False, Motif
will ensure that the focus stays at widget old_focus.
old_focusIndicates the widget ID of the widget that had keyboard focus immediately
prior to the most recent traversal.
new_focusIndicates the widget ID of the widget that has just gotten keyboard focus.
focus_policyIndicates the VendorShell's keyboard focus policy; this will always
be XmEXPLICIT since callback_procedure only gets called in explicit
mode.
directionSpecifies the direction of the traversal. (See
XmProcessTraversal(3) in the Motif Programmer's
Reference for details on possible values of the XmTraversalDirection
enumerated type.)
RELATED
XmeRemoveFocusChangeCallback(3).
[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]