×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    17

    Question Which item on a form is selected

    I have 2 datefields on a form and an itemCommand to update the selected datefield to the current date/time.

    How do I determine which datefield item is currently selected so I can set the selected datefield?

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Which item on a form is selected

    Quote Originally Posted by ksadil View Post
    I have 2 datefields on a form and an itemCommand to update the selected datefield to the current date/time.

    How do I determine which datefield item is currently selected so I can set the selected datefield?
    You need to setItemCommandListener on the datefield
    public void setItemCommandListener(ItemCommandListener l)Sets a listener for Commands to this Item, replacing any previous ItemCommandListener. A null reference is allowed and has the effect of removing any existing listener.
    It is illegal to call this method if this Item is contained within an Alert.


    Parameters:
    l - the new listener, or null.
    Throws:
    IllegalStateException - if this Item is contained within an Alert
    Since:
    MIDP 2.0

    It calls back to -- commandAction(Command c, Item item)
    where you get the ref to the item on which the command was fired.
    Thanks,
    Ekta

  3. #3
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Re: Which item on a form is selected

    Also you can use ItemStateListener(Item item ) and can check with the item name ie let suppose you have two DateFields like DF1 and DF2. So you can check
    if (item == DF1){// do the needful}
    else if(item == DF2)
    {// do the needful}
    thanks,
    jitu_goldie..

    KEEP TRYING..

Similar Threads

  1. Getting a Form selected item
    By giaviv in forum Mobile Java General
    Replies: 1
    Last Post: 2010-02-13, 22:57
  2. Find which item is selected on Form
    By prajapati.ajay in forum Mobile Java General
    Replies: 2
    Last Post: 2009-03-25, 15:38
  3. Depend on the selected List Box item , redirect to another Form ?
    By waruni.k in forum Symbian User Interface
    Replies: 6
    Last Post: 2008-09-02, 03:43
  4. Replies: 1
    Last Post: 2008-05-15, 07:59
  5. How to get selected index of Item in a Form ?
    By akokchai in forum Mobile Java General
    Replies: 1
    Last Post: 2004-02-23, 01:40

Posting Permissions

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