I assumed that you meant 6.2.1 and tested an example on 6.3 and 6.2.1.
I get the same results on both. When the dialog is present, I have the
hotkey callback of the window and the dialog called. When the dialog
isn’t present, I just get the hotkey callback of the window called. Now,
I can get rid of the dialog and the window callbacks from being called
by making sure that the dialog doesn’t have a parent, but for your
problem with the window hotkey callback being called twice, I will need
an example.
Hi,
I am using 6.1.1 at the moment.
Will.
“Rodney Dowdall” <> rdowdall@qnx.com> > wrote in message
news:ckp5r4$53b$> 1@inn.qnx.com> …
Hello Will
What version of the OS are you using?
Thanks,
Rodney
Will O’Neill wrote:
The application is a PhAB project and the callbacks are being added in
PhAB.
I have a base window, and a second window which is opened from the base
window, I’m not sure if this makes it a child window or not. The two
windows both have hotkey callbacks for the same key, but the callbacks
themselves are different.
If I press the hotkey on the child window, the handler for the child
window
is called, and then the handler for the base window is called.
If I press the hotkey on the base window, the handler for the base
window is
called twice.
“Rodney Dowdall” <> rdowdall@qnx.com> > wrote in message
news:ckm7dj$okt$> 1@inn.qnx.com> …
Hello Will
Lets see if I have this straight
You have two windows, a bas window and a dialog window ( I am assuming,
despite the reports of what assumptions due to people ). You have the
same hotkey handler on both the window and the dialog? You see the way
hotkeys are supposed to be handled is that they are delivered to the
window and then the window figures out what is supposed to happen to
them. The weird thing is that you seem to be having the exact opposite
behaviour as Bill Caroselli ( see post Hotkey Callbacks posted July 28
), in which the hotkey was only being delivered to base window. Are you
specifying the same callback for both windows, in other words both
callbacks point to the same function? Is the one window a child of the
base window? Is this a PhAB project? Are you adding the hotkey callback
through PhAB or through code?
Thanks,
Rodney
Will O’Neill wrote:
The EmitKeyPress isn’t generated at the moment as a result of a key
press,
so I think I should only see the one I generate.
What seems to be happening is that the hotkey handler of a the window I
have
open is called, and then the base window’s hotkey handler is called.
If
I
am on the base window, the hotkey handler is called twice. It look
like
the
sort of thing that should be fixed by setting the Pt_HOTKEY_TERMINATOR
flag,
although this doesn’t seem to have any effect.
“Rodney Dowdall” <> rdowdall@qnx.com> > wrote in message
news:ckk2e3$4va$> 1@inn.qnx.com> …
Hello Will
Where does EmitKeyPress get called from? Is there a chance you are
picking up the orignal keypress folowed by your own?
Thanks,
Rodney
Will O’Neill wrote:
Hello,
I’m using PhEmit to generate a keypress, which I am handling in my
photon
app with a hotkey callback. For some reason it always seems to
generate
2
hotkey events for every keypress I generate. I have tried adding in
a
raw
event callback to see what events are being received, and it looks as
though
it only receives two keypresses (2x key down,key up) when I add in
the
hotkey callback. If I get rid of it, only the 1 keypress is
received.
My function for generating keypressses is listed below.
If anyone has any ideas on why this is happening, it would be much
appreciated.
Thanks,
Will.
void EmitKeyPress ( long scan_code )
{
PhKeyEvent_t key_event;
PhEvent_t ph_event;
PhRect_t rect;
/*----- Initialise
variables -----------------------------------------*/
rect.ul.x = rect.ul.y = EVENT_X;
rect.lr.x = rect.lr.y = EVENT_Y;
memset(&ph_event , 0, sizeof(ph_event));
memset(&key_event, 0, sizeof(key_event));
ph_event.type = Ph_EV_KEY;
ph_event.emitter.rid = Ph_DEV_RID;
ph_event.num_rects = 1;
ph_event.data_len = sizeof(key_event);
ph_event.input_group = 1;
key_event.key_cap = key_event.key_sym = scan_code;
key_event.key_mods = 0;
/* Key Down */
key_event.key_flags = ( Pk_KF_Key_Down | Pk_KF_Sym_Valid |
Pk_KF_Cap_Valid );
PhEmit(&ph_event, &rect, &key_event);
/* Key Up */
key_event.key_flags = Pk_KF_Cap_Valid;
PhEmit(&ph_event, &rect, &key_event);
}
\