×

Discussion Board

Results 1 to 12 of 12

Thread: Event handling

  1. #1
    Registered User
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43

    Event handling

    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
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: Event handling

    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
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43

    Re: Event handling

    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
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Event handling

    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
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: Event handling

    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
    Join Date
    Jan 2008
    Posts
    387

    Re: Event handling

    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
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43

    Re: Event handling

    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
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: Event handling

    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
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: Event handling

    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
    Join Date
    Jun 2009
    Location
    Kolkata
    Posts
    43

    Re: Event handling

    Ok. Thanks.
    Can you give me some useful links?
    Warm regards,
    Manoj Paul

  11. #11
    Regular Contributor
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: Event handling

    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
    Join Date
    Jan 2008
    Posts
    387

    Re: Event handling

    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
    Replies: 3
    Last Post: 2009-05-20, 04:54
  2. key handling and handling event??
    By bakidilek in forum Symbian
    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
    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
  •  
×