×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    98

    Smile List Box application

    hi,
    I have created list box with two items in it.Now on opening the first item i need another list with two or more items.But on opening the first item the application is getting closed.Please help..???
    Here is my code..

    /*****appview****/

    CreateWindowL();
    iListBox = new (ELeave) CAknDoubleGraphicStyleListBox;
    iListBox->ConstructL(this, EAknListBoxSelectionList);
    iListBox->SetContainerWindowL(*this);
    iListBox->ActivateL();
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);

    FillListBoxL();

    iListBox->DrawNow();
    SetRect( aRect );
    ActivateL();

    void CHelloWorldVarunAppView::FillListBoxL()
    {
    _LIT(KItemTextDouble1, "0\tFirst item\tHello");
    _LIT(KItemTextDouble2, "1\tSecond item\thello1");

    CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(2);

    CleanupStack::PushL(array);
    array->AppendL(KItemTextDouble1);
    array->AppendL(KItemTextDouble2);
    CleanupStack::Pop();

    iListBox->Model()->SetItemTextArray(array);
    CArrayPtr<CGulIcon>* iconArray = new (ELeave) CArrayPtrFlat<CGulIcon>(2);
    CleanupStack::PushL(iconArray);
    _LIT(KIconFile,"c:\\ImagePlugin.MBM");
    iconArray->AppendL( iEikonEnv->CreateIconL( KIconFile,0,1) );
    iconArray->AppendL( iEikonEnv->CreateIconL( KIconFile,6,7) );
    iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray);
    CleanupStack::Pop();
    iListBox->HandleItemAdditionL();


    /****Appui****/

    case EHelloWorldVarunCommand3:
    {
    if(iAppView -> CurrentItemIndex1()==0)
    {
    iAppView -> FillListBox0L();
    //iAppView->iListBox->DrawNow();
    }
    else if(iAppView -> CurrentItemIndex1()==1)
    {
    iAppView -> FillListBox1L();
    //iAppView->iListBox->DrawNow();
    }


    /*********AppView*******/

    void CHelloWorldVarunAppView::FillListBox0L()
    {
    iListBox->Reset();
    _LIT(KItemTextDouble3, "3\tThird item\tBox");
    _LIT(KItemTextDouble4, "4\tFourth item\tBox1");

    CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(2);

    CleanupStack::PushL(array);
    array->AppendL(KItemTextDouble3);
    array->AppendL(KItemTextDouble4);
    CleanupStack::Pop();

    iListBox->Model()->SetItemTextArray(array);
    iListBox->HandleItemAdditionL();
    iListBox->DrawNow();
    }


    void CHelloWorldVarunAppView::FillListBox1L()
    {
    _LIT(KItemTextDouble5, "5\tFifth item\tBox3");
    _LIT(KItemTextDouble6, "6\tSixth item\tBox4");

    CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(2);

    CleanupStack::PushL(array);
    array->AppendL(KItemTextDouble5);
    array->AppendL(KItemTextDouble6);
    CleanupStack::Pop();

    iListBox->Model()->SetItemTextArray(array);
    iListBox->HandleItemAdditionL();
    iListBox->DrawNow();
    }

    TInt CHelloWorldVarunAppView::CurrentItemIndex1()
    {
    TInt i = iListBox->CurrentItemIndex();
    return i;
    }

  2. #2
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: List Box application

    Hi,

    Try to use CurrentItemIndex() instead of CurrentItemIndex1(). I think you need to use multiview for your application.
    Regards,
    Nini

  3. #3
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,561

    Re: List Box application

    Run in debug mode and check if
    TInt i = iListBox->CurrentItemIndex();
    is having proper value when returning.
    I have doubts of that segment and the following(in logical sequence)

    good luck
    cheers
    Neil

  4. #4
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    98

    Exclamation Re: List Box application

    Hi Symbian_Neil,

    TInt i = iListBox->CurrentItemIndex();
    This is returning proper value.
    The application is giving unhandled exception in the line iListBox->Drawnow(); of the function FillListBox0L(), if First Item is selected or iListBox->Drawnow(); of the function FillListBox1L() if the SecondItem is selected.

    Thanks in advance.

    Regards,
    techietintu

  5. #5
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,561

    Re: List Box application

    hi,

    check out the multiview example given in S60 3rd Edition SDK for Symbian OS, Supporting Feature Pack 1, for C++. Maybe you will find your answer there.

    Good luck
    cheers
    Neil

  6. #6
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    98

    Exclamation Re: List Box application

    Hi Symbian_Neil,

    My first listbox is static and it is having 2 items so now I can implement multiview for this. If my first listbox is dynamic how will I know how many views to have in my application.
    Is there any other way to get listbox on click of the item in the previous listbox.

    Thanks in advance.

    Regards,
    techietintu

  7. #7
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,561

    Re: List Box application

    Are you saying that you have some enteries(number of enteries unknown) and then when you select one entry, it should give more information regarding the same??

  8. #8
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    98

    Re: List Box application

    Hi,

    I have unknow number of entries(any number of entries varying from 3 to 8) in a listbox, on click of one item it should give me one more listbox(This may contain known number of entries).

    Regards,
    techietintu

  9. #9
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,561

    Re: List Box application

    i dont know how relevant it is or maybe i am telling you something which you already..but approach would be :
    you can use TKeyResponse..OfferKeyEventL
    There you could do something like this :

    TInt selInd = iBox->CurrentItemIndex();
    TAgnEntryId selId = iIdArray->At(selInd);
    ReadExtraTextL(selId);

    Dont know if it works..or that would solve your problem...

    But anyway ..goodluck
    Cheers
    Neil

  10. #10
    Registered User
    Join Date
    Mar 2007
    Posts
    5

    Re: List Box application

    Hi,

    i am a symbian newbie. can you share the source code of creating a list box of 3 or 4 items.and
    by selecting a item i should get another list box. i want the complete set of code including
    (.cpp.h.rss.mmp.rls) say complete project of listbox. here i am using S60_3rd_FP1 and Carbide.c++
    Thanks in advance
    Last edited by sudan; 2007-04-02 at 11:36.

  11. #11
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,561

    Re: List Box application

    Quote Originally Posted by sudan
    Hi,

    i am a symbian newbie. can you share the source code of creating a list box of 3 or 4 items.and
    by selecting a item i should get another list box. i want the complete set of code including
    (.cpp.h.rss.mmp.rls) say complete project of listbox. here i am using S60_3rd_FP1 and Carbide.c++
    Thanks in advance
    You have been replied by Tina and myself in this thread

Similar Threads

  1. Replies: 0
    Last Post: 2006-06-04, 14:23
  2. problem with list box
    By srkreddy999 in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-09-30, 10:44
  3. List Box in Series60
    By anupamcins in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-11-20, 10:38
  4. Replies: 1
    Last Post: 2004-03-01, 08:37
  5. Please Solve my problem with List Box
    By Nilesh_Kul in forum Symbian User Interface
    Replies: 10
    Last Post: 2003-04-17, 23:13

Posting Permissions

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