1. You must Register an Event handler function by using
XtAddEventHandler(Widget             widget,
                           EventMask        mask,
                           Boolean            nonMaskable,
                           XtEventHandler   handler,
                           XtPointer          clientData)
In your case EventMask  have to be TRUE.
clientData alows passing data to applications when the event handler is
called.

2.  The form of the every event handler function (the callback) must be:
void EventHandler       (Widget   w,
                                Xtpointer   clientData,
                                XEvent      *event,
                                BOOLEAN  *continueToDispatch)
This is the form of the function which is to be called when you generate
the event.

3. Now, the use of this functions it's not straightforward and the best
thing is to see a
program doing event handling. The function arguments for example deserve a
separate
discussion.
I sugest an example from the Motif/Xt OSF books or Douglas Young
"Progarmming
and Aplications with Xt". There is a complete program on Douglas book about

Event handlers-the second book it's with me now, but surely deals with
keyboard
events.
Three- four years ago there were good sites on Xt/Motif-don't know
the situation now but it's worth looking for them.


It is rather difficults working with  Xt/Motif - but surely they are
a well designed OO peace of sw.


Shlomi Fish wrote:

> Right now I have to work with Xt/Motif (against my will) and I have the
> following question:
>
> Let's suppose I have a window and I wish to make sure that whenever I
> press 'q' or 'h', a callback function is called. How do I do that?
>
> Please give me a step-by-step recipe.
>
> TIA,
>
>         Shlomi Fish
>
> ----------------------------------------------------------------------
> Shlomi Fish        [EMAIL PROTECTED]
> Home Page:         http://t2.technion.ac.il/~shlomif/
> Home E-mail:       [EMAIL PROTECTED]
>
> "Let's suppose you have a table with 2^n cups..."
> "Wait a second - is n a natural number?"
>
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to