PocketMatrix forums

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

[windows mobile] key event issue

hi Edge,

1)
In some reason, we're trying to NOT use lockkey param in the main config
(ecd.maincfg->lockkeys = false;)
And handle all the key events in the OnNativeEvent().

What we want to catch is key - VK_TEND (end key).
But We can't receive WM_KEYDOWN and only WM_KEYUP along with VK_TEND.

Before WM_KEYUP is received, edge app will be pushed to background by pressing end key (VK_TEND)...
To prevent this, we want to handle the end key behavior by ourselves.

2)
and the 2nd question is how to dynamically change lockkey param.
It's also failed to make affective by using ecd.maincfg->lockkeys = false;

Can you tell me how to solve these problems?


Thanks,
mamahow
Hi Mamahow,

Currently it's not possible to use the VK_TEND key, it will probably be added to a later EDGELIB release.

For locking the keys in your application we recommend setting the lockkeys setting to false. Then you can handle the locking of keys yourself. Please refer to the Windows Mobile functions:
GXOpenInput/GXCloseInput
SHSetAppKeyWndAssoc

You can also try to return true in your OnNativeEvent callback function.
Hi Edge,
After set lockkey to false then handle key event by us, such as

Code:

bool ClassMain::OnNativeEvent(ENATIVETYPE winhandle, ENATIVETYPE msg, ENATIVETYPE param1, ENATIVETYPE param2)
{
switch(msg)
{
case WM_KEYUP:
// only get WM_KEYUP
break;
case WM_KEYDOWN:
// can't get WM_KEYDOWN
switch(param1)
{
case VK_TEND:
printf("got VK_TBACK\r");
ret = true;
break;
}
}
}


But I can't receive WM_KEYDOWN (only WM_KEYUP) through OnNativeEvent,
is there something I missed?

I also tried to always return true then I can get WM_KEYDOWN, is this behavior normal?


Thank,
mamahow
Hi,

Yes, it's normal behaviour to return true when handling the WM_KEYDOWN and WM_KEYUP messages. From our own experiences some buttons may have alternative behaviour (for example only receiving WM_KEYDOWN). A good example is the red 'end dial' button on some Smartphones.