Discussion Board

Results 1 to 12 of 12

Thread: Event handling

  1. #1
    Registered User manojpaul's Avatar
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43
    Hi!

    Can we add an event to List?

    Like say: I want to display at the ticker the content of the list which is selected.
    If I select List index[0], then the content of the List at zero will be shown at the ticker and so on for which ever index I select from the List.
    When I press down the down arrow of my keyboard that particular index should be displayed only and not on Pressing the Ok button which goes for the commandAction (Command c, Displayable d) method. There must be some event handling for the problem which I am facing but not sure about it.

    Using this code only display the text of the first selected item which is selected by default:
    Code:
    getTicker().setString(titleArray[0]);
    mainList.setTicker(getTicker());
    If someone can please throw some lights on this.

    Thanks,
    Warm regards,
    Manoj Paul

  2. #2
    Regular Contributor vivartpandey's Avatar
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105
    yes you can do this.
    public void listAction() {

    String __selectedString = getList().getString(getList().getSelectedIndex());
    if (__selectedString != null) {
    if (__selectedString.equals("List Element 1")) {

    ticker.setString("List Element 1");


    } else if (__selectedString.equals("List Element 2")) {

    ticker.setString("List Element 2");


    } else if (__selectedString.equals("List Element 3")) {

    ticker.setString("List Element 3");


    }
    }

    }
    Be hungry,Be foolish
    vivart pandey

  3. #3
    Registered User manojpaul's Avatar
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43
    Hi Vivart!

    Thanks for the reply.
    But my question is how/where should I call this method?
    I couldn't find any event handling code on the net.
    Can you please advice?

    Thanks once again.
    Warm regards,
    Manoj Paul

  4. #4
    Nokia Developer Champion raj_J2ME's Avatar
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,314
    Hi,
    If I am not wrong then you should call the on the keypressed,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor vivartpandey's Avatar
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105
    i think this code is self explanatory.
    Code:
    public void commandAction(Command command, Displayable displayable) {
           
            if (displayable == list) {
                if (command == List.SELECT_COMMAND) {
                    
                    listAction();
                    
                } else if (command == exitCommand1) {
                   
                    exitMIDlet();
                    
                } else if (command == okCommand) {
                    
                    switchDisplayable(null, getForm());
                    
                }
            }
            
        }
    Be hungry,Be foolish
    vivart pandey

  6. #6
    Regular Contributor manjul_saini's Avatar
    Join Date
    Jan 2008
    Posts
    387
    simply in commandAction where is your command select or whatever write

    ticker.setString("bla bla.....");
    tht all!
    Thanks and Regards,
    Manjul.

  7. #7
    Registered User manojpaul's Avatar
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43
    Hi!

    Sorry but its not working at all.
    As I press the up/down arrow key in my keyboard the commandAction(Command command, Displayable displayable) is not invoked at all. The method is called only if I press the Ok button or if I press the enter key in my keyboard. I may have missed something in the code, but not sure what.

    If you can explain it would of great help.
    Warm regards,
    Manoj Paul

  8. #8
    Regular Contributor vivartpandey's Avatar
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105
    hi manjul_saini
    i have already given code of listAction() function.
    what you want more.how to create ticker,list, form or how to add ticker.
    if you want this, first read a good book of j2me first.
    Be hungry,Be foolish
    vivart pandey

  9. #9
    Regular Contributor vivartpandey's Avatar
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105
    Quote Originally Posted by manojpaul View Post

    Like say: I want to display at the ticker the content of the list which is selected.
    sorry i missunderstood i thought that selected means you are clicking on that list element,
    but you want to say that just highlighted.
    sorry this event is not available in javame you have to create a custom item.
    Be hungry,Be foolish
    vivart pandey

  10. #10
    Registered User manojpaul's Avatar
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43
    Ok. Thanks.
    Can you give me some useful links?
    Warm regards,
    Manoj Paul

  11. #11
    Regular Contributor vivartpandey's Avatar
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105
    you should read this article
    Custom List item with marquee effect
    i think this will help you.
    Be hungry,Be foolish
    vivart pandey

  12. #12
    Regular Contributor manjul_saini's Avatar
    Join Date
    Jan 2008
    Posts
    387
    What does it means? i did not ask any question? or did i said some thing wrong? or some body gonna insane?

    Quote Originally Posted by vivartpandey View Post
    hi manjul_saini
    i have already given code of listAction() function.
    what you want more.how to create ticker,list, form or how to add ticker.
    if you want this, first read a good book of j2me first.
    Thanks and Regards,
    Manjul.

Similar Threads

  1. Problems with Event Handling
    By chandras2k6 in forum Symbian C++
    Replies: 3
    Last Post: 2009-05-20, 04:54
  2. key handling and handling event??
    By bakidilek in forum Python
    Replies: 4
    Last Post: 2009-01-02, 17:35
  3. Help me for touch Screen Event Handling
    By nil.bagul in forum Mobile Java General
    Replies: 1
    Last Post: 2008-03-28, 11:22
  4. CLogEvent problem
    By silviuccia in forum Symbian C++
    Replies: 2
    Last Post: 2006-12-22, 15:28
  5. N6600 Button Event Handling
    By wildan_ali in forum Mobile Java General
    Replies: 2
    Last Post: 2004-10-20, 16:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved