EVT_CHAR and QWERTY | developer.brewmp.com EVT_CHAR and QWERTY | developer.brewmp.com

Developer

EVT_CHAR and QWERTY

Hello,

We are moving our app to the VX9800. It is a 3D title using Mascot Capsule. Thus it is sucking up more bandwidth than your normal app. We had planned on using some of the letter buttons on the keyboard to control the game, but have found that these events do not occur. Essentially, I have code that does something like this:

EVT_CHAR:
EVT_UPDATECHAR: // Doing this just to see what happens
pMe->charWParam |= wParam;
pMe->charDWParam |= dwParam;
return TRUE;

Then on each frame, we print out the results on screen.

The value always stays at 0.

Note this code does work properly on the simulator for the VX9800 (not that really means anything). Moreover, the letter buttons I have activated will work properly.

Here are some other details/questions:

-We are compiling using the 2.0.1 version of BREW. This should not matter.
-Is there anything on the phone you need to set to make it pass the character events?
-Is there anything in code I have to enable to allow these events?
-Are these events really supported?

BTW, I have done both a Forum search for EVT_CHAR and VX9800. Nothing really pops up addressing this.

Thanks.

Ben

Hello mobileben,
I am having same issue as well with the QWERTY keyboard. In my VX9800 simulator (with Tools>Enable Char Events checked), the alphabets keys are not even lite up when pressed where as the number keys are. Did you use the Device Configurator to tweak the simulator to turn on the alphabet keys?
I am certain there must be a way to support the QWERTY keyboard on VX9800 because I just downloaded a commercial BREW app which has a text input box with full QWERTY support.
Any help is appreciated!

Hello mobileben,
I am having same issue as well with the QWERTY keyboard. In my VX9800 simulator (with Tools>Enable Char Events checked), the alphabets keys are not even lite up when pressed where as the number keys are. Did you use the Device Configurator to tweak the simulator to turn on the alphabet keys?
I am certain there must be a way to support the QWERTY keyboard on VX9800 because I just downloaded a commercial BREW app which has a text input box with full QWERTY support.
Any help is appreciated!

For the simulator, our EVT_CHAR code just worked "right out of the box". So we thought it would work fine on the phone. We pushed to code onto the phone and no dice. I also then dumped event information and saw EVT_CHAR was not being passed in.
As a final step, reviewed the BREW SDK docs to see if there is a SW setting and could not find one (doesn't mean that there isn't one or it isn't documented ... just I didn't see it) AND went through the phone menus seeing if there was a setting for keys. Nothing.
We actually changed the game not use QWERTY.
BTW, built in BREW constructs may have specialized ways of trapping for this information. So unfortunately, I would consider that even though a BREW text box may support QWERTY, it does not necessarily mean those events are passed in.

For the simulator, our EVT_CHAR code just worked "right out of the box". So we thought it would work fine on the phone. We pushed to code onto the phone and no dice. I also then dumped event information and saw EVT_CHAR was not being passed in.
As a final step, reviewed the BREW SDK docs to see if there is a SW setting and could not find one (doesn't mean that there isn't one or it isn't documented ... just I didn't see it) AND went through the phone menus seeing if there was a setting for keys. Nothing.
We actually changed the game not use QWERTY.
BTW, built in BREW constructs may have specialized ways of trapping for this information. So unfortunately, I would consider that even though a BREW text box may support QWERTY, it does not necessarily mean those events are passed in.

EVT_CHAR is not firing on LG VX9800.

EVT_CHAR is not firing on LG VX9800.

We are seeing the same issue.
Qualcomm support guys...any idea why? Is this not implemented by LG?

We are seeing the same issue.
Qualcomm support guys...any idea why? Is this not implemented by LG?

When pressing the alpha keys on the LG 9800, you will receive the following:
In default mode:
AEEEvent=EVT_KEY_PRESS wParam=ASCII value of key pressed
AEEEvent=EVT_KEY wParam=ASCII value of key pressed
There are two other modes on the device: Shift and SYM. You do not need to worry about handling these separately. The wParam will be correct, based on the key press. For example, in default mode the 'm' key will send 109. In shift mode, it will send 77 ('M') and in SYM modem, it will send 63('?')
In all the above, dwParam will be set to NULL
Few things to note:
(1) No EVT_KEY_RELEASE (except for numeric/directional keys)
(2) No dwParam = KB_AUTOREPEAT
(3) No EVT_KEY_HELD (deprecated in 3.x)
That said:
If you are using BREW's text controller, you will not need to do anything for the text control to work.
If you are using a custom control or the text widget, you will need to do something like this:
First, associate a handler with your text widget:
HANDLERDESC_Init(&pMe->ui.m_ITextWdtHandler,(PFNHANDLER) TextWdtHandleEvent, pMe, NULL);
IWIDGET_SetHandler(pMe->ui.m_pITextWdt, &pMe->ui.m_ITextWdtHandler);
Next, handle the EVT_KEY events in your handler:
boolean TextWdtHandleEvent(buit* pMe, AEEEvent evt, uint16 wParam, uint32 dwParam) {
if (EVT_KEY == evt) {
if (AVK_CAPLK == wParam) { // Do not pass AVK_CAPLK to the default text controller
return TRUE;
}
else if (AVK_STAR == wParam) { // The default behavior of AVK_STAR is to change the “mode” of the device (Multitap/Numeric/etc.). With the QWERTY keypad, this is no longer necessary. Send ‘*’ instead.
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR) '*', dwParam);
}
else if (AVK_POUND == wParam) { // The default behavior of AVK_POUND is to insert a space. With the QWERTY keypad this is again not necessary. Send ‘#’ instead.
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR) '#', dwParam);
}
else if (wParam >= AVK_0 && wParam <= AVK_9) { // For AVK_*, pass the numeric value of the key pressed
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR)(wParam - AVK_0 + '0'), dwParam);
}
else if (wParam < AVK_FIRST) { // Handle the QWERTY alpha, shift and symbol keys
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR) wParam, dwParam);
}
}
// Let the default text controller handle everything else (such as AVK_CLR, AVK_LEFT, AVK_RIGHT, etc.)
return HANDLERDESC_Call(&pMe->ui.m_ITextWdtHandler, evt, wParam, dwParam);

Note that simulator behaves differently because it send EVT_CHAR... this is not the expected result on the device.(Therefore for testing, click the alpha keys in the simulator, instead of typing them on the keyboard).
Finally, if you are trying to time the keys, you may find it difficult with the latest build. This is because there is no EVT_KEY_RELEASE and there is no KB_AUTOREPEAT.

When pressing the alpha keys on the LG 9800, you will receive the following:
In default mode:
AEEEvent=EVT_KEY_PRESS wParam=ASCII value of key pressed
AEEEvent=EVT_KEY wParam=ASCII value of key pressed
There are two other modes on the device: Shift and SYM. You do not need to worry about handling these separately. The wParam will be correct, based on the key press. For example, in default mode the 'm' key will send 109. In shift mode, it will send 77 ('M') and in SYM modem, it will send 63('?')
In all the above, dwParam will be set to NULL
Few things to note:
(1) No EVT_KEY_RELEASE (except for numeric/directional keys)
(2) No dwParam = KB_AUTOREPEAT
(3) No EVT_KEY_HELD (deprecated in 3.x)
That said:
If you are using BREW's text controller, you will not need to do anything for the text control to work.
If you are using a custom control or the text widget, you will need to do something like this:
First, associate a handler with your text widget:
HANDLERDESC_Init(&pMe->ui.m_ITextWdtHandler,(PFNHANDLER) TextWdtHandleEvent, pMe, NULL);
IWIDGET_SetHandler(pMe->ui.m_pITextWdt, &pMe->ui.m_ITextWdtHandler);
Next, handle the EVT_KEY events in your handler:
boolean TextWdtHandleEvent(buit* pMe, AEEEvent evt, uint16 wParam, uint32 dwParam) {
if (EVT_KEY == evt) {
if (AVK_CAPLK == wParam) { // Do not pass AVK_CAPLK to the default text controller
return TRUE;
}
else if (AVK_STAR == wParam) { // The default behavior of AVK_STAR is to change the “mode” of the device (Multitap/Numeric/etc.). With the QWERTY keypad, this is no longer necessary. Send ‘*’ instead.
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR) '*', dwParam);
}
else if (AVK_POUND == wParam) { // The default behavior of AVK_POUND is to insert a space. With the QWERTY keypad this is again not necessary. Send ‘#’ instead.
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR) '#', dwParam);
}
else if (wParam >= AVK_0 && wParam <= AVK_9) { // For AVK_*, pass the numeric value of the key pressed
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR)(wParam - AVK_0 + '0'), dwParam);
}
else if (wParam < AVK_FIRST) { // Handle the QWERTY alpha, shift and symbol keys
return IWIDGET_HandleEvent(pMe->ui.m_pITextWdt, EVT_CHAR, (AECHAR) wParam, dwParam);
}
}
// Let the default text controller handle everything else (such as AVK_CLR, AVK_LEFT, AVK_RIGHT, etc.)
return HANDLERDESC_Call(&pMe->ui.m_ITextWdtHandler, evt, wParam, dwParam);

Note that simulator behaves differently because it send EVT_CHAR... this is not the expected result on the device.(Therefore for testing, click the alpha keys in the simulator, instead of typing them on the keyboard).
Finally, if you are trying to time the keys, you may find it difficult with the latest build. This is because there is no EVT_KEY_RELEASE and there is no KB_AUTOREPEAT.

Thank You.
I implemented just that and it works.
-V

Thank You.
I implemented just that and it works.
-V

I tied that with the ITEXT_CTL interface and didn't worked ...
HandleTextEvent((GETAPPINSTANCE()) *pme, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
if(eCode == EVT_KEY_RELEASE || eCode == EVT_KEY_PRESS || eCode == EVT_KEY || eCode == EVT_CHAR)
{
if (AVK_CAPLK == wParam)
{ // Do not pass AVK_CAPLK to the default text controller
return TRUE;
}
else
if (AVK_STAR == wParam)
{ // The default behavior of AVK_STAR is to change the “mode” of the device (Multitap/Numeric/etc.). With the
QWERTY keypad, this is no longer necessary. Send ‘*’ instead.
return pme->OnEvent( EVT_CHAR, (AECHAR) '*', dwParam);
}
else
if (AVK_POUND == wParam)
{ // The default behavior of AVK_POUND is to insert a space. With the QWERTY keypad this is again not necessary. Send ‘#’ instead.
return pme->OnEvent( EVT_CHAR, (AECHAR) '#', dwParam);
}
else
if (wParam >= AVK_0 && wParam <= AVK_9)
{ // For AVK_*, pass the numeric value of the key pressed
return pme->OnEvent( EVT_CHAR, (AECHAR)(wParam - AVK_0 + '0'), dwParam);
}
else
if (wParam < AVK_FIRST) // Handle the QWERTY alpha, shift and symbol keys
{
return ITEXTCTL_HandleEvent(pme>pITextCtl,EVT_CHAR, (AECHAR) wParam, dwParam);
}
}
return pme->OnEvent(eCode, wParam, dwParam);

Any suggestions ?

I tied that with the ITEXT_CTL interface and didn't worked ...
HandleTextEvent((GETAPPINSTANCE()) *pme, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
if(eCode == EVT_KEY_RELEASE || eCode == EVT_KEY_PRESS || eCode == EVT_KEY || eCode == EVT_CHAR)
{
if (AVK_CAPLK == wParam)
{ // Do not pass AVK_CAPLK to the default text controller
return TRUE;
}
else
if (AVK_STAR == wParam)
{ // The default behavior of AVK_STAR is to change the “mode” of the device (Multitap/Numeric/etc.). With the
QWERTY keypad, this is no longer necessary. Send ‘*’ instead.
return pme->OnEvent( EVT_CHAR, (AECHAR) '*', dwParam);
}
else
if (AVK_POUND == wParam)
{ // The default behavior of AVK_POUND is to insert a space. With the QWERTY keypad this is again not necessary. Send ‘#’ instead.
return pme->OnEvent( EVT_CHAR, (AECHAR) '#', dwParam);
}
else
if (wParam >= AVK_0 && wParam <= AVK_9)
{ // For AVK_*, pass the numeric value of the key pressed
return pme->OnEvent( EVT_CHAR, (AECHAR)(wParam - AVK_0 + '0'), dwParam);
}
else
if (wParam < AVK_FIRST) // Handle the QWERTY alpha, shift and symbol keys
{
return ITEXTCTL_HandleEvent(pme>pITextCtl,EVT_CHAR, (AECHAR) wParam, dwParam);
}
}
return pme->OnEvent(eCode, wParam, dwParam);

Any suggestions ?

Yeap .. I have to post in order to discover my mistakes :( ...
Before ITEXTCTL_HandleEvent() there should be at least something like this:
ITEXTCTL_SetRect(pme->pITextCtl,pme->pRect);
ITEXTCTL_SetActive(pme->pITextCtl,TRUE);

Yeap .. I have to post in order to discover my mistakes :( ...
Before ITEXTCTL_HandleEvent() there should be at least something like this:
ITEXTCTL_SetRect(pme->pITextCtl,pme->pRect);
ITEXTCTL_SetActive(pme->pITextCtl,TRUE);

So I have the same problem. I need to handle the key_release event but there is no such event for the qwerty keys.
Is there any workarownd? Is there a way to get the status of a key?
I'm not using text controls . The application is game.
10x for the Help ;)

So I have the same problem. I need to handle the key_release event but there is no such event for the qwerty keys.
Is there any workarownd? Is there a way to get the status of a key?
I'm not using text controls . The application is game.
10x for the Help ;)

Does QWERTY work on the simulator?

Does QWERTY work on the simulator?

Hi,
I am facing similar problem in QWERTY keyboard. I am working on motorola QWERTY device, B3.1.5 and ITextControl
I read the posts on QWERTY but didnt find useful for me.
There are keys like Fn: AVK_FUNCTION wParam: 57405 [for symbols written on top corner of keys eg key 'A' has '-']
SYM/CAPS: AVK_CAPLK for typing in uppercase and symbols wParam: 57428.
On pressing 'a' i get wparam 97 and 'a' is visible on the text control. When I press CAPS button, I get wParam: 57428, which is correct. But now if I press 'a' I should get 65 for capital 'A' but I get 97 and 'a' is printed on the text control.
Please help me. I am using native BREW ITextControl.
if((wParam != AVK_LEFT && wParam != AVK_RIGHT && wParam != AVK_UP && wParam != AVK_DOWN && wParam != AVK_FUNCTION && wParam != AVK_CAPLK && wParam != AVK_ENTER && wParam != AVK_CAMERA && wParam != AVK_MESSAGE && wParam != AVK_SPEAKER && wParam != AVK_WEB_ACCESS)){
isActive = ITEXTCTL_HandleEvent(pETextCtl->pTextCtl, EVT_CHAR, wParam, dwParam);
}
else
return SUCCESS;
Thanks
Sam

Hi,
I am facing similar problem in QWERTY keyboard. I am working on motorola QWERTY device, B3.1.5 and ITextControl
I read the posts on QWERTY but didnt find useful for me.
There are keys like Fn: AVK_FUNCTION wParam: 57405 [for symbols written on top corner of keys eg key 'A' has '-']
SYM/CAPS: AVK_CAPLK for typing in uppercase and symbols wParam: 57428.
On pressing 'a' i get wparam 97 and 'a' is visible on the text control. When I press CAPS button, I get wParam: 57428, which is correct. But now if I press 'a' I should get 65 for capital 'A' but I get 97 and 'a' is printed on the text control.
Please help me. I am using native BREW ITextControl.
if((wParam != AVK_LEFT && wParam != AVK_RIGHT && wParam != AVK_UP && wParam != AVK_DOWN && wParam != AVK_FUNCTION && wParam != AVK_CAPLK && wParam != AVK_ENTER && wParam != AVK_CAMERA && wParam != AVK_MESSAGE && wParam != AVK_SPEAKER && wParam != AVK_WEB_ACCESS)){
isActive = ITEXTCTL_HandleEvent(pETextCtl->pTextCtl, EVT_CHAR, wParam, dwParam);
}
else
return SUCCESS;
Thanks
Sam