PtAddHotkeyHandler

Hi!

I’m having some problems using PtAddHotkeyHandler.

I need to have a window with many widgets responding to hotkey events. If I
add these hotkey callbacks by PhAB, that’s ok, all widgets behave like I
want to. However, if I add the same callbacks by code, using
PtAddHotkeyHandler, the same widget gets the hotkey event all the times and
it doesn’t let this event goes to its brothers, even if I return
Pt_CONTINUE.

I don’t know if I’m doing something wrong, but I don’t think so because
while I was debugging the program I saw the widget’s structure and the
hotkey_cb resource was ok. But of course, I might be wrong.

Here is the part where I try to add the hotkey callbacks.

PtAddHotkeyHandler (list, Pk_minus, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);
PtAddHotkeyHandler (list, Pk_plus, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);
PtAddHotkeyHandler (list, Pk_KP_Substract, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);
PtAddHotkeyHandler (list, Pk_KP_Add, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);


Could anyone help me?

Thanks,

Vanessa Shimada

Hello Vanessa

What is list pointing to? Are you changing it somewhere else at all?

Thanks
Rodney



Previously, Vanessa Shimada wrote in qdn.public.qnxrtp.photon:

Hi!

I’m having some problems using PtAddHotkeyHandler.

I need to have a window with many widgets responding to hotkey events. If I
add these hotkey callbacks by PhAB, that’s ok, all widgets behave like I
want to. However, if I add the same callbacks by code, using
PtAddHotkeyHandler, the same widget gets the hotkey event all the times and
it doesn’t let this event goes to its brothers, even if I return
Pt_CONTINUE.

I don’t know if I’m doing something wrong, but I don’t think so because
while I was debugging the program I saw the widget’s structure and the
hotkey_cb resource was ok. But of course, I might be wrong.

Here is the part where I try to add the hotkey callbacks.

PtAddHotkeyHandler (list, Pk_minus, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);
PtAddHotkeyHandler (list, Pk_plus, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);
PtAddHotkeyHandler (list, Pk_KP_Substract, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);
PtAddHotkeyHandler (list, Pk_KP_Add, 0, Pt_HOTKEY_SYM, NULL,
CFwUiSpin::Hotkey_cb);


Could anyone help me?

Thanks,

Vanessa Shimada

Hi, Rodney!

list is a PtList widget. In that code I wrote I was only trying to add some
hotkey callbacks to PtList widget. Is there something wrong there? And no,
I’m not changing any resources of list in my code, at least for now.

I really need to know how to add hotkey handler callbacks by code because
I’ll have to create some widgets by code in my application. Temporaly I’m
adding those callbacks by PhAB, but it really would help me if you know what
else I have to do to this work by code.

Let me try to explain better.

I have a widget tree of a PtWindow like this:

Base1 (PtWindow)
|- button1 (PtButton)
|- button2 (PtButton)
|- list1 (PtList)
|- list2 (PtList)

If I add hotkey callbacks of the same keys by code, it’s button1 which catch
the key event all the times, doesn’t matter which widget has the input
focus. Otherwise, if I add these by PhAB it works fine.

Thanks in advance,

Vanessa

gui@qnx.com escreveu na mensagem …

Hello Vanessa

What is list pointing to? Are you changing it somewhere else at all?

Thanks
Rodney

Hello Vanessa

Could you send me your Hotkey callback code for each widget and maybe a test application (if possible). I can’t seem to reproduce the problem here.

Thanks
Rodney

Previously, Vanessa Shimada wrote in qdn.public.qnxrtp.photon:

Hi, Rodney!

list is a PtList widget. In that code I wrote I was only trying to add some
hotkey callbacks to PtList widget. Is there something wrong there? And no,
I’m not changing any resources of list in my code, at least for now.

I really need to know how to add hotkey handler callbacks by code because
I’ll have to create some widgets by code in my application. Temporaly I’m
adding those callbacks by PhAB, but it really would help me if you know what
else I have to do to this work by code.

Let me try to explain better.

I have a widget tree of a PtWindow like this:

Base1 (PtWindow)
|- button1 (PtButton)
|- button2 (PtButton)
|- list1 (PtList)
|- list2 (PtList)

If I add hotkey callbacks of the same keys by code, it’s button1 which catch
the key event all the times, doesn’t matter which widget has the input
focus. Otherwise, if I add these by PhAB it works fine.

Thanks in advance,

Vanessa

gui@qnx.com > escreveu na mensagem …
Hello Vanessa

What is list pointing to? Are you changing it somewhere else at all?

Thanks
Rodney
\

Hello Vanessa

Yes I received it and I hope to be able to test it today and come up with an answer for you.

Thanks
Rodney

Previously, Vanessa Shimada wrote in qdn.public.qnxrtp.photon:

Hi, Rodney!

Have you received an e-mail with a test application I sent to you? If you
didn’t, I’ll send it again.

Thanks,

Vanessa

gui@qnx.com > escreveu na mensagem …
Hello Vanessa

Could you send me your Hotkey callback code for each widget and maybe a
test application (if possible). I can’t seem to reproduce the problem here.

Thanks
Rodney
\

Hello Vanessa

You have to specify a flag to your call of PtAddHotkeyHandler.
It is an undeocumented flag (which I wasn’t aware of) and it is
Pt_HOTKEY_CHAINED. Basically your call is going to look like this

PtAddHotkeyHandler (ABW_list1, Pk_F1, 0, Pt_HOTKEY_SYM | Pt_HOTKEY_CHAINED, NULL, keyPressed);

I will talk to our docs people about having this added.

Hope this solves your problem
Rodney



Previously, gui@qnx.com wrote in qdn.public.qnxrtp.photon:

Hello Vanessa

Yes I received it and I hope to be able to test it today and come up with an answer for you.

Thanks
Rodney

Previously, Vanessa Shimada wrote in qdn.public.qnxrtp.photon:
Hi, Rodney!

Have you received an e-mail with a test application I sent to you? If you
didn’t, I’ll send it again.

Thanks,

Vanessa

gui@qnx.com > escreveu na mensagem …
Hello Vanessa

Could you send me your Hotkey callback code for each widget and maybe a
test application (if possible). I can’t seem to reproduce the problem here.

Thanks
Rodney


\

Hi, Rodney!

Have you received an e-mail with a test application I sent to you? If you
didn’t, I’ll send it again.

Thanks,

Vanessa

gui@qnx.com escreveu na mensagem …

Hello Vanessa

Could you send me your Hotkey callback code for each widget and maybe a
test application (if possible). I can’t seem to reproduce the problem here.

Thanks
Rodney

Thanks a lot, Rodney!

This works fabulous!

Vanessa