using the same hotkey on multiple buttons

I’m writing an app for my embedded thingy that uses soft keys for menu
selection and navigation. the way I’m implementing it is to use
buttons with hotkey callbacks . i have a numeric keypad beside the
screen
that also has a,b,c,d so I’m using these for soft keys.

the problem i’m having is if i have a dialog with over top of the main
dialog the hotkey callbacks don’t work in the child dialog. if i
enable hotkeys first the button hotkey callbacks are activated by the
hotkeys even if it is covered up by the child.
i tried blocking the buttons on the main dialog in the hopes that the
child dialog would then start processing them but to no avail…

I’m probably missing some huge concept in photon programming as i am
very new to photon… can someone point out where I’m going wrong
here???


vince

i get it… if the child window doesn’t have keyboard focus its hotkeys will be ignored… i would have though that when the child dialog was realized that i would have automaticly gotten screen and keyboard focus…

so if wanted to give the child dialog keyboard focus in its realize function how would i do this? would i use PtContainerGiveFocus() ?

vince…

Previously, Norbert Black wrote in qdn.public.qnxrtp.photon:

vince <> vgeisler@engineer.com> > wrote:
I’m writing an app for my embedded thingy that uses soft keys for menu
selection and navigation. the way I’m implementing it is to use
buttons with hotkey callbacks . i have a numeric keypad beside the
screen
that also has a,b,c,d so I’m using these for soft keys.

the problem i’m having is if i have a dialog with over top of the main
dialog the hotkey callbacks don’t work in the child dialog. if i
enable hotkeys first the button hotkey callbacks are activated by the
hotkeys even if it is covered up by the child.
i tried blocking the buttons on the main dialog in the hopes that the
child dialog would then start processing them but to no avail…

I’m probably missing some huge concept in photon programming as i am
very new to photon… can someone point out where I’m going wrong
here???


Yep – “keyboard focus” > :slight_smile: > Each application has one (or
sometimes, no) widget that is marked be the first to get any
keyboard events that arrive at the application. There’s a
section on focus handling in the programmer’s guide, I believe.

Have a look at that, and see if the fog lifts, OK?


Norbert Black
QSSL Training Services

vince <vgeisler@engineer.com> wrote:

I’m writing an app for my embedded thingy that uses soft keys for menu
selection and navigation. the way I’m implementing it is to use
buttons with hotkey callbacks . i have a numeric keypad beside the
screen
that also has a,b,c,d so I’m using these for soft keys.

the problem i’m having is if i have a dialog with over top of the main
dialog the hotkey callbacks don’t work in the child dialog. if i
enable hotkeys first the button hotkey callbacks are activated by the
hotkeys even if it is covered up by the child.
i tried blocking the buttons on the main dialog in the hopes that the
child dialog would then start processing them but to no avail…

I’m probably missing some huge concept in photon programming as i am
very new to photon… can someone point out where I’m going wrong
here???

Yep – “keyboard focus” :slight_smile: Each application has one (or
sometimes, no) widget that is marked be the first to get any
keyboard events that arrive at the application. There’s a
section on focus handling in the programmer’s guide, I believe.

Have a look at that, and see if the fog lifts, OK?


Norbert Black
QSSL Training Services

vince <lab-101@usa.net> wrote:

i get it… if the child window doesn’t have keyboard focus its
hotkeys will be ignored…

Yep, that’s it in a nutshell.

i would have though that when the child dialog was realized
that i would have automaticly gotten screen and keyboard focus…

That’s the default behaviour (at least with applications created
in PhAB) if any of the widgets in the dialog is marked as
focusable (Pt_GETS_FOCUS bit in Pt_ARG_FLAGS). Are you working
in PhAB, or creating completely from code?

Check to make sure the widgets you want to have keyboard input
are focusable. You might also want to look for Pt_SELECTABLE
while you’re looking, just to prevent another possible problem
(mouse input…) down the road.

so if wanted to give the child dialog keyboard focus in its
realize function how would i do this? would i use
PtContainerGiveFocus() ?

You can certainly swap focus around programmatically if you need
to. As I said, you may not need to.

Have fun! :slight_smile:

Norbert Black
QSSL Training Services

Works like a charm!.. thanks for the help

vince…


On 8 Jan 2001 20:40:13 GMT, Norbert Black <nblack@qnx.com> wrote:

vince <> lab-101@usa.net> > wrote:
i get it… if the child window doesn’t have keyboard focus its
hotkeys will be ignored…

Yep, that’s it in a nutshell.

i would have though that when the child dialog was realized
that i would have automaticly gotten screen and keyboard focus…

That’s the default behaviour (at least with applications created
in PhAB) if any of the widgets in the dialog is marked as
focusable (Pt_GETS_FOCUS bit in Pt_ARG_FLAGS). Are you working
in PhAB, or creating completely from code?

Check to make sure the widgets you want to have keyboard input
are focusable. You might also want to look for Pt_SELECTABLE
while you’re looking, just to prevent another possible problem
(mouse input…) down the road.

so if wanted to give the child dialog keyboard focus in its
realize function how would i do this? would i use
PtContainerGiveFocus() ?

You can certainly swap focus around programmatically if you need
to. As I said, you may not need to.

Have fun! > :slight_smile:

Norbert Black
QSSL Training Services

vince <vgeisler@engineer.com> wrote:

Works like a charm!.. thanks for the help

No problem. Thanks for taking the time to let us know the
result.


Norbert Black
QSSL Training Services

Norbert Black <nblack@qnx.com> wrote:

vince <> vgeisler@engineer.com> > wrote:
Works like a charm!.. thanks for the help

No problem. Thanks for taking the time to let us know the
result.



Norbert Black
QSSL Training Services

I read this short thread and I’m still not getting it.

I have a base window with a hotkey ( key does a CANCEL).
I have a dialog window that defines the same hotkey ( key does
a CANCEL).

The intent is that the key should dismiss any window the same as
a CANCEL button callback in that window.

But the key get caught by the base window and terminates the
whole application. This I don’t want.

What piece of magic am I missing to only catch the key from the
dialog window?

Bill Caroselli <qtps@earthlink.net> wrote:

I read this short thread and I’m still not getting it.

I have a base window with a hotkey ( key does a CANCEL).
I have a dialog window that defines the same hotkey ( key does
a CANCEL).

The intent is that the key should dismiss any window the same as
a CANCEL button callback in that window.

But the key get caught by the base window and terminates the
whole application. This I don’t want.

What piece of magic am I missing to only catch the key from the
dialog window?

Never mind, Got it from the
Re: arrggg… now my app responds to hotkeys too well…
thread.