So I have tried to implement some virtual keyboard functionality...
I have done this by implementing these two methods in my Moblet:
void OnMobile::pressKey(int keyCode)
{
fireKeyPressEvent(keyCode, 0);
}
void OnMobile::releaseKey(int keyCode)
{
fireKeyReleaseEvent(keyCode, 0); // line 37
}These methods are part of a KeyEventInjector interface that the Moblet implements. An instance of this interface (I.e. the Moblet instance) is then sent to the ctor of a class called OnScreenKeyboard that translated mouse clicks to keyboard events using pressKey/releaseKey.
Is this a safe approach to implementing a virtual keyboard? What value am I supposed to use for the second argument , nativeCode, of fireKeyReleaseEvent?
I'm asking because I'm getting a panic in releaseKey():
[13] MoSync Panic 40033. "Instruction memory access out of bounds" The panic occurred in the MoSync core. [13] IP:0xeccc: crtlib.s:1 [13] IP:0x24: C:/work/ecode3/onmobile/mosync/onMobile/src/main.cpp:16 [13] IP:0x1a702: crtlib.s:1 [13] IP:0x17b44: crtlib.s:1 [13] IP:0xcf7: C:/work/ecode3/onmobile/mosync/onMobile/src/OnScreenKeyboard.hpp:18 [13] IP:0xd9d: C:/work/ecode3/onmobile/mosync/onMobile/src/OnScreenKeyboard.cpp:152 [13] IP:0x102e: C:/work/ecode3/onmobile/mosync/onMobile/src/OnMobile.hpp:9 [13] IP:0x1061: C:/work/ecode3/onmobile/mosync/onMobile/src/OnMobile.cpp:37 [13] Exit @ IP 0x1716f SP 0x1fef0 [13] IP:0x1716f: crtlib.s:1
This particular call to release key is when I destroy the current screen and display a new screen. I was hoping that I would be able to use the debugger to see what happened inside fireKeyReleaseEvent(), but for some reason I can't start the debugger (see: http://www.mosync.com/forum/viewtopic.php?f=18&t=215). As far as I can see something in fireKeyReleaseEvent triggers this panic.
Anyway, my basic question is this: Is my approach to implementing virtual keyboard functionality safe. Can I expect my Moblet instance be the Environment instance that I should use to fire key events?
:.:: mattias