×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Amsterdam, NL
    Posts
    53

    low-level event question

    Hi. This is part of my code, and I need to add some functionality.
    Code:
    else if(command.getCommandType() == Command.OK)
    		{
    			int index = list.getSelectedIndex();
    			switch(index)
    			{
    			case 0:
    				newTags = new Tags(this);
    				displayMgr.pushDisplayable();
    				display.setCurrent(newTags.list);
    				break;
    .
    .
    .
    I want to do the same when the RIGHT_KEY is pressed, that is create a Tags and set its list as current. Moreover, when i click LEFT_KEY (after i clicked the right one) I want to go back. Can anybody help? I read about the Canvas class but couldn't get it...
    Thanks for any help.
    Last edited by xarris_; 2007-05-20 at 22:18.

  2. #2
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    307

    Re: low-level event question

    You can detect the left and right soft keys by the keyCode, provided with the keyPressed() method of the Canvas.

    The value -6 is assigned to the LEFT_SOFTKEY_CODE, while -7 is assigned to the RIGHT_SOFTKEY_CODE. These values are presented on all Nokia phones, and even on some phones from the other vendors.

  3. #3
    Regular Contributor
    Join Date
    Apr 2007
    Location
    Amsterdam, NL
    Posts
    53

    Re: low-level event question

    Actually i want to use the right and left from the 5way navigation key. But anyway, my problem is more on the implementation than to the code that is assigned on the keys. Can i use directly "if" statements in the commandAction method, that will check the value of the key pressed?

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280

    Re: low-level event question

    With the high-level UI (Forms, Lists, Commands) that you are using you don't have low-level access, so you don't have a way to react to specific keys.

    If you use a Canvas you have the keyPressed() method that will tell you exactly what key is pressed, but then you have to make your own GUI (your own Lists and Forms drawn on a Canvas).

    You can sort of mix high-level and low-level using a CustomItem (MIDP 2.0 only), but then you will only get the low level events if your CustomItem has the focus.

    shmoove

Similar Threads

  1. Low level and High Level User Interface....?
    By MitchDoan in forum Mobile Java General
    Replies: 8
    Last Post: 2009-03-31, 16:53
  2. How to display a long text and textbox in low level
    By Basu in forum Mobile Java General
    Replies: 2
    Last Post: 2007-03-31, 08:02
  3. Low Level implemenation using Commands(High Level API) is this possible
    By shanemurphy30 in forum Mobile Java General
    Replies: 4
    Last Post: 2007-01-23, 16:42
  4. CLogEvent problem
    By silviuccia in forum Symbian
    Replies: 2
    Last Post: 2006-12-22, 15:28
  5. question about EStdKeyApplicationF event
    By eagle2fly in forum Symbian
    Replies: 0
    Last Post: 2003-10-30, 02:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×