Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi all,
I want to use a button for 2 tasks. for normal key press (OK key) and for longer key press which should invoke anathor function. how can i do this??

dattanand wrote:Hi all,
I want to use a button for 2 tasks. for normal key press (OK key) and for longer key press which should invoke anathor function. how can i do this??
#define THECTIME 600
uint32 time;
on key pressed :
time = GETTIMEMS();
on key released:
if( GETTIMEMS()- time < THECTIME )
executeCommand1();
else
executeCommand2();
this is only 1 method. there are others methods too :). the advantage of this is that you can use it also on other platforms( j2me... )

dattanand wrote:Hi all,
I want to use a button for 2 tasks. for normal key press (OK key) and for longer key press which should invoke anathor function. how can i do this??
#define THECTIME 600
uint32 time;
on key pressed :
time = GETTIMEMS();
on key released:
if( GETTIMEMS()- time < THECTIME )
executeCommand1();
else
executeCommand2();
this is only 1 method. there are others methods too :). the advantage of this is that you can use it also on other platforms( j2me... )

For long key press BREW would send EVT_KEY_PRESS and KB_AUTOREPEAT in the dwParam. You can use that and deduce your result

For long key press BREW would send EVT_KEY_PRESS and KB_AUTOREPEAT in the dwParam. You can use that and deduce your result

Hi,
thx for ur replies. I tried to handle the key events, but could not do so. It seems you have to register your application with NMASK_SHELL_KEY mask. now how do i register my app for this??

Hi,
thx for ur replies. I tried to handle the key events, but could not do so. It seems you have to register your application with NMASK_SHELL_KEY mask. now how do i register my app for this??

Is this for a background app? Because normal apps don't need to register for key events as they should receive EVT_KEY_PRESS events through the main event handler. If it is a background app, a search on the Forums finds this thread for registering to receive key events:
http://brewforums.qualcomm.com/showthread.php?t=13261&page=2&pp=15

Is this for a background app? Because normal apps don't need to register for key events as they should receive EVT_KEY_PRESS events through the main event handler. If it is a background app, a search on the Forums finds this thread for registering to receive key events:
http://brewforums.qualcomm.com/showthread.php?t=13261&page=2&pp=15

Franz.Iacob wrote:#define THECTIME 600
uint32 time;
on key pressed :
time = GETTIMEMS();
on key released:
if( GETTIMEMS()- time < THECTIME )
executeCommand1();
else
executeCommand2();
this is only 1 method. there are others methods too :). the advantage of this is that you can use it also on other platforms( j2me... )
Hi,
I an trying to use GETUPTIMEMS() instead of GETTIMEMS(). but it always returns zero on emulator. can it be used on emulator??

Franz.Iacob wrote:#define THECTIME 600
uint32 time;
on key pressed :
time = GETTIMEMS();
on key released:
if( GETTIMEMS()- time < THECTIME )
executeCommand1();
else
executeCommand2();
this is only 1 method. there are others methods too :). the advantage of this is that you can use it also on other platforms( j2me... )
Hi,
I an trying to use GETUPTIMEMS() instead of GETTIMEMS(). but it always returns zero on emulator. can it be used on emulator??

dattanand wrote:Hi,
I an trying to use GETUPTIMEMS() instead of GETTIMEMS(). but it always returns zero on emulator. can it be used on emulator??
Yes. I have used them. i get proper values.

dattanand wrote:Hi,
I an trying to use GETUPTIMEMS() instead of GETTIMEMS(). but it always returns zero on emulator. can it be used on emulator??
Yes. I have used them. i get proper values.