×

Discussion Board

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

    CAknListQueryDialog: get selected items text

    Hallo,

    need some help

    After I got a pointer to the Listbox I dont know how to get the text of the selected item.
    I searched the forum, nothing.
    Such as:
    Model()->ItemText(ItemSelected) brings no success.
    In this state the app crashed after Dialog OK pressing.

    Plz help.



    case ECommand2_1: //free
    {
    CArrayFixFlat<TInt>* indexArray = new(ELeave)CArrayFixFlat<TInt>(5);
    CleanupStack::PushL(indexArray);
    CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog(indexArray);
    if ( dlg->ExecuteLD(R_DEMO_LIST_QUERY ) )
    {
    CEikListBox* zzz = new (ELeave) CEikListBox;
    zzz = dlg->ListBox();
    TInt ItemSelected = zzz->CurrentItemIndex();

    //How to access the items text ??????????????

    }
    CleanupStack::PopAndDestroy();// indexArray
    }
    break;

  2. #2
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: CAknListQueryDialog: get selected items text

    You need to get the index of the Text Array which gives you the selected item index.
    would be nice if you could go through the List Query example of EMCC..

    Priju

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    30

    Re: CAknListQueryDialog: get selected items text

    I downloaded the sample chapters now.
    Thanks


    best regards
    Last edited by koreson; 2006-11-17 at 12:36.

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

    Re: CAknListQueryDialog: get selected items text

    @Priju Jacob Paul

    ok, I have done it like the expample shows:


    iListQueryItemArray = new (ELeave) CDesCArrayFlat(6);
    _LIT (KStringHeader, "Item No %d");
    TBuf <16> aString;
    for (TInt i = 1; i<= 5; i++)
    {
    aString.Format(KStringHeader(), i);
    iListQueryItemArray->AppendL (aString);
    }
    TInt index(0); // the index of the selected item
    CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog(&index);
    query->PrepareLC(R_LISTQUERY_LIST_QUERY);
    query->SetItemTextArray(iListQueryItemArray);
    query->SetOwnershipType (ELbmDoesNotOwnItemArray);
    if (query->RunLD())
    {
    SaveGameToFileL((*iListQueryItemArray)[index]);
    }

    List dialog runs but:

    SaveGameToFileL((*iListQueryItemArray)[index]) declared inline in *.h file: void SaveGameToFileL(const TDesC&) {};

    Is there no implementation for SaveGameToFileL ?

    Im totaly confused.

    How handles SaveGameToFileL its parameter to get the text of the selected item ???



    best regards

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    30

    Re: CAknListQueryDialog: get selected items text

    Problem solved:


    iListQueryItemArray = new (ELeave) CDesCArrayFlat(5);
    CleanupStack::PushL(iListQueryItemArray);
    _LIT (KStringHeader, "Item No %d");
    TBuf <32> aString;
    for (TInt i = 1; i<= 5; i++)
    {
    aString.Format(KStringHeader(), i);
    iListQueryItemArray->AppendL (aString);
    }



    TInt index(0); // the index of the selected item
    CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog(&index);

    query->PrepareLC(R_LISTQUERY_LIST_QUERY);
    query->SetItemTextArray(iListQueryItemArray);
    query->SetOwnershipType (ELbmDoesNotOwnItemArray);
    if (query->RunLD())
    {

    TPtrC16 zzz = (*iListQueryItemArray)[index];
    TBuf<32> CurrListCont = zzz.Left(30);
    iEikonEnv->AlertWin(CurrListCont);


    }

Similar Threads

  1. Replies: 3
    Last Post: 2008-09-04, 11:53
  2. problem with selected text
    By aurphius in forum Symbian
    Replies: 1
    Last Post: 2006-05-30, 10:46
  3. Replies: 2
    Last Post: 2005-06-07, 10:03
  4. Replies: 0
    Last Post: 2004-11-24, 18:49
  5. Accepting multiselection list when no items are selected
    By jsheli2 in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-11-14, 04:52

Posting Permissions

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