PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

KeyDown/KeyUp events trigger twice for Axim x50v, but not PC

I know.. I know.. it's me yet again.

Now before you jump to the conclusion "it's not GapiDraw," please keep in mind I thoroughly tested this time, and even reproduced the results on the samples provided with GapiDraw itself.

I honestly didn't notice this until it caused a weird bug in my app that wasn't present in the PC version. I used the debugger to step through what was going on, and it turned out it was calling the KeyUp event twice. I decided to look through my code, and nothing was wrong. I then decided to start up a sample app (TileDemo in this case) and use the same debugging techniques. It was reproduced in the sample application.

Here's what I did;

- I set a break point on the KeyUp and KeyDown events located in myapplication.cpp.
- I ran the TileDemo in debug mode for Pocket PC 2003 Device.
- I hit a button (any one, it doesn't matter) on my pocket pc.
- The debugger stopped on the KeyDown event. I went to the Debug menu and clicked "Go" so it would continue to execute. It immediately went straight back to the KeyDown event. I DID NOT press another key, nor has it even stopped at the break point of the KeyUp event.
- The same was repeat for the KeyUp event.

This is only with KeyUp and KeyDown. Stylus events were fine.

Any idea what could be happening? Thanks for your time.

EDIT:
It's happening at the CGapiApplication level. The WM_KEYDOWN msg is sent twice to WindProc. No idea why either. I did notice you had a safe guard against key repeat events, but in this case it's not stopping the double event.

Does anyone have an Axim x50v to double check my results and confirm this is a bug?
I am no expert here but aren’t two messages generated for some buttons i.e. the jog or rocker buttons; one to identify the button pressed and the second to identify the direction of the press. Perhaps one of the experts can confirm this?
Yes, that's correct. Newer versions of CGapiApplication (3.5a and later) should filter these keycodes so that only the key code is received in OnKeyDown, not the key identification code.

What version of GapiDraw do you use?
I am not a developer, but I noticed this behavior in a few games (whose names escape me, since I could not play them) where every button press was registered twice while playing. Obviously this is hardware specific (Asus MyPal 716) in some cases, otherwise the author probably would have fixed it.
Johan wrote:Yes, that's correct. Newer versions of CGapiApplication (3.5a and later) should filter these keycodes so that only the key code is received in OnKeyDown, not the key identification code.

What version of GapiDraw do you use?


3.5b eval
I think I've found it:

It appears the value 91 is sent first, before the actual keycode. Best I can figure, check for value 91 and don't send it through the keydown or keyup event.

Can anyone confirm this?
Dan, I believe those are called "shadow" keycodes. If you search the Pocketmatrix forums, there have been several discussions regarding this issue.

- Erick
egarayblas wrote:Dan, I believe those are called "shadow" keycodes. If you search the Pocketmatrix forums, there have been several discussions regarding this issue.

- Erick


Ah thanks, I found a few old threads on it.