×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    33

    Handling key pressed events

    I have created a List in my MIDlet, how can i detected if a key is pressed in the List.
    I know that event handling for key pressed is available in Canvas, can i used similar method to do this on my List?
    Or is there any information can help me?

    Thanks a lot!!

  2. #2
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    66
    and, I think using a commandlistener in standard j2me GUI is much more suitable.
    unless you draw in canvas, then you should use keypress....

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    33
    I have added the commandListener to my list, but I only know that when the user pressed a command button (e.g. EXIT button), i can write down :
    if (c == cmExit) {...}
    in the commandAction(Command c, Displayable s) function.

    What should I write if i want to detect the user pressed a key(e.g. KEY_NUM6) in the phone?

    Thanks!!

  4. #4
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    66
    if you want the user input something by using key_num_6 in text field or text box, then you dont need to do anything..
    but , if you want to have specific funtion for that ...for example in game, key_unm_6 ususally used for going right...then you have to use Canvas...
    .

  5. #5
    Registered User
    Join Date
    Nov 2004
    Posts
    33

    Thanks a lot!!

    I will try it then.

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    37

    Re: Handling key pressed events

    Is it possible to tell if a user pressed the number keys while using the High level UI api or do I have to use the low level ui api?

  7. #7
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    101

    Re: Handling key pressed events

    Hi all,
    I have written an exe program, which is running in background and is listening for Send key(green key) pressing for example.
    But I need a program to listen for any key pressing and can detect which key is pressed, and compaire it with a code,
    I don't want this just do listening for the send key, I want it can captures any key then detect what was pressed!

    I am using this code, how can I chsange it for my porpuse?


    ...
    iWinGroup.CaptureKeyUpAndDowns(127, 0, 0);
    iWsSession.EventReady(&iStatus);
    SetActive();
    ...

  8. #8
    Registered User
    Join Date
    Apr 2011
    Posts
    35

    Re: Handling key pressed events

    Hi

    Im also facing the same problem.How to handle key pressed event in List implemented with Custom Item

  9. #9
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Handling key pressed events

    Quote Originally Posted by H@RIPRIY@KOND@PI View Post
    Hi

    Im also facing the same problem.How to handle key pressed event in List implemented with Custom Item
    When this list is in focus, you will keyPressed(int key) called whenever a key is pressed by the user.

    Refer to Wiki example - http://www.developer.nokia.com/Commu...tem_in_Java_ME
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

Posting Permissions

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