Keyboard Input

Hello.

I have a PtRaw widget for which I would like to have several event handlers.

Can I use the following?

PtAddEventHandler(pwRaw, Ph_EV_BUT_PRESS|Ph_EV_BUT_RELEASE|
Ph_EV_PTR_MOTION_BUTTON, TxEventMouse, NULL);
PtAddEventHandler(pwRaw, Ph_EV_KEY, TxEventKey, NULL);

Or do I have to use PtAddEventHandlers()?

In my example, the first callback (TxEventMouse) is getting called okay.

The second callback never gets called (TxEventKey), event when I comment out
the first call to PtAddEventHandler(). Why? What did I forget to set for
the PtRaw widget so I can get the key events?

Can you point any examples that deal with this topic? I have searched QDN
and the on-line docs for this and found nothing.

I would like to know, for example when the user hits the ‘Delete’ key or the
PtRaw widget.

Can you explain where ‘key’ events get directed to as far as widget focus
versus window focus?

Thanks

Augie

Augie Henriques <augiehenriques@hotmail.com> wrote:
: Hello.

Seeing as no one has given you an answer, I’ll take a stab at it.

: I have a PtRaw widget for which I would like to have several event handlers.

: Can I use the following?

: PtAddEventHandler(pwRaw, Ph_EV_BUT_PRESS|Ph_EV_BUT_RELEASE|
: Ph_EV_PTR_MOTION_BUTTON, TxEventMouse, NULL);
: PtAddEventHandler(pwRaw, Ph_EV_KEY, TxEventKey, NULL);

: Or do I have to use PtAddEventHandlers()?

Either method should work.

: In my example, the first callback (TxEventMouse) is getting called okay.

: The second callback never gets called (TxEventKey), event when I comment out
: the first call to PtAddEventHandler(). Why? What did I forget to set for
: the PtRaw widget so I can get the key events?

Just a guess, but PtRaw doesn’t have Pt_GETS_FOCUS set in its Pt_ARG_FLAGS, so
I doubt that it gets key events. Try setting this bit, and see what happens.

: Can you point any examples that deal with this topic? I have searched QDN
: and the on-line docs for this and found nothing.

: I would like to know, for example when the user hits the ‘Delete’ key or the
: PtRaw widget.

If anyone figures this out, I’ll add it to the docs.

: Can you explain where ‘key’ events get directed to as far as widget focus
: versus window focus?

I’m not exactly sure what you want to know (not am I sure I know the answer).
The events are passed down the family hierarchy. The “Event handlers” section
in the Events chapter of the Programmer’s Guide describes what happens.

Does this help?


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Steve Reid <stever@qnx.com> wrote:
: Just a guess, but PtRaw doesn’t have Pt_GETS_FOCUS set in its Pt_ARG_FLAGS, so
: I doubt that it gets key events. Try setting this bit, and see what happens.

I tried setting Pt_GETS_FOCUS in a sample application here, and it seems to
do the trick.

: : Can you explain where ‘key’ events get directed to as far as widget focus
: : versus window focus?

: I’m not exactly sure what you want to know (not am I sure I know the answer).
^^^
That should be “nor” – how I wish I’d learned to type properly years ago!

: The events are passed down the family hierarchy. The “Event handlers” section
: in the Events chapter of the Programmer’s Guide describes what happens.

: Does this help?


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems