×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    25

    Unhappy (HELP!)How to know which item was selected in a Grid or ListBox?

    Here I declare a container itself as a listbox observer (class CMyContainer : public MEikListBoxObserver within the header file); thus it implements HandleListBoxEventL(), as shown below:

    void CMyContainer::HandleListBoxEventL(
    CEikListBox* aListBox, TListBoxEvent aEventType)
    {
    if (aEventType == EEventEnterKeyPressed)
    {
    // I know I could really do something here but I just wonder how to do different thing when i select different item!
    }
    }
    The container has set itself to be the Listbox’s observer ( iListBox-> SetListBoxObserver(this) ) within the Container’s ConstructL().

    I know I could really do something but I just wonder how to do different things when i select a different item!
    Last edited by palmelf.christ; 2006-11-02 at 06:10.
    mailto:palmelf.christ@gmail.com

  2. #2
    Regular Contributor
    Join Date
    Apr 2006
    Location
    India
    Posts
    383

    Re: (HELP!)How to know which item was selected in a Grid or ListBox?

    Hi!

    Use CurrentItemIndex()

    CurrentItemIndex()
    TInt CurrentItemIndex() const;
    Description
    Gets the index number of the current item in the view.

    Return value
    TInt Index number of the current item.

    Hope this helps u
    Regards,
    Shilpa Kulkarni

  3. #3
    Super Contributor
    Join Date
    Aug 2005
    Location
    india
    Posts
    2,078

    Re: (HELP!)How to know which item was selected in a Grid or ListBox?

    hi,


    void CMyContainer::HandleListBoxEventL(CEikListBox* , TListBoxEvent aListBoxEvent)
    {

    if ((aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed) ||
    (aListBoxEvent == MEikListBoxObserver::EEventItemClicked))
    {
    LoadSelectedOption();
    }
    }

    void CMyContainer::LoadSelectedOption()
    {
    iMyView=new CMyView();
    TInt iViewId(0);

    TInt optionSelected = iListBox->CurrentItemIndex();

    switch(optionSelected)
    {
    case 1:
    iViewId = ECmd1;
    break;
    case 2:
    iViewId = ECmd1;
    break;
    case 3:
    iViewId = ECmd1;
    break;

    }
    iMyView->HandleCommandL(iViewId);
    Thanks and Regards,
    Mateen Maldar
    "Whatever the mind can conceive and believe, the mind can achieve"

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    25

    Smile Re: (HELP!)How to know which item was selected in a Grid or ListBox?

    Thank you mateen_maldar!
    mailto:palmelf.christ@gmail.com

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    179

    Re: (HELP!)How to know which item was selected in a Grid or ListBox?

    Quote Originally Posted by mateen_maldar View Post
    hi,





    Thanks and Regards,
    Mateen Maldar
    Hi all,
    i have a Setting list (from class CAknSettingItemList) and it contains many items (Enumerated items , Binary items , Numeric items ).My question is : Can i use CurrentItemIndex() Method to get which item is currently highlighted or the fire key pressed on?
    and what .h & .lib files needed ?
    thanks in advance,
    regards

Similar Threads

  1. getting the item from listbox
    By srkreddy999 in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-10-20, 13:23
  2. How to change Grid Selected Text Item?
    By ardc_21 in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-06-29, 09:15
  3. How to delete the last item in a listbox
    By zhang_guoqing in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-07-21, 07:28
  4. retrieving selected item from a listbox
    By nshankar in forum Symbian User Interface
    Replies: 2
    Last Post: 2003-03-21, 07:42
  5. How do I remove selected item from listbox?
    By mmalo in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-07-25, 06:12

Posting Permissions

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