Problem with List box (please help)

Login to reply to this topic.
Fri, 2007-07-27 10:02
Joined: 2007-07-24
Forum posts: 24

In my application, i inserted one list box. After running it, I can see scroll bar
but can't see ant items in it.

I'm trying it on Series 60 3rd Edition, FP1

Here is my Listbox code............

void CNew_ListBoxAppView::CreateListBoxL(const TRect&/* aRect*/)
{
        iListBox = new (ELeave ) CAknDoubleStyleListBox();
       
        iListBox->ConstructL(this, EAknListBoxSelectionList );
        iListBox->SetContainerWindowL(*this);

        //add scroll bar to the list
        iListBox->CreateScrollBarFrameL(ETrue);
        iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn,
                                                                                                                CEikScrollBarFrame::EAuto);
        iListBox->View()->SetBackColor(KRgbRed);

        const TPoint aPoint(20,80);
        const TSize aSize(180,150);
       
        //most important line , else the lst box simply disappears
        iListBox->SetExtent(aPoint,aSize);
        //Fill list box with the data

        InitTaskList();//Call for function
       
        iListBox->HandleItemAdditionL();
        iListBox->SetCurrentItemIndexAndDraw(itemList->Count() - 1); // select new item


        iListBox->ActivateL();
        iListBox->DrawNow();
}

void CNew_ListBoxAppView::InitTaskList()
{

        _LIT(KString1,"ITEM_Head");
        _LIT(KString2,"ITEM_Detail");

        TInt AAppCount = 4;//get the number of applications

        iAppCount = AAppCount;
       
        iAppList = new (ELeave) CDesCArrayFlat(AAppCount);

       
//        iListBox->Reset();
       
                itemList  = new (ELeave) CDesCArrayFlat(AAppCount);
                TBuf<200> Item;

                Item.Format(_L("\t%S\t%S\t"), &KString1,&KString2);
                itemList->AppendL(Item);
               
                Item.Format(_L("\t%S\t%S\t"), &KString1,&KString2);
                itemList->AppendL(Item);
               
                Item.Format(_L("\t%S\t%S\t"), &KString1,&KString2);
                itemList->AppendL(Item);
               
                Item.Format(_L("\t%S\t%S\t"), &KString1,&KString2);
                itemList->AppendL(Item);
                               
                       
                //set items and ownership
                iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);       
                iListBox->Model()->SetItemTextArray(itemList);

                iListBox->SetFocus(ETrue);
}


Fri, 2007-07-27 13:20
Joined: 2007-06-20
Forum posts: 93
Re: Problem with List box (please help)

hi,
What u want to say

but can't see ant items in it.
May be u want to say when u run ur app not any item is visible in listbox .. i m rite ??? Run ur App in Debug mode. set breakpoint and check what u do wrong... any way u also check this link
http://wiki.forum.nokia.com/index.php/How_to_create_a_simple_listbox


Thanks & Regards,
C Singh

Mon, 2007-07-30 05:53
Joined: 2007-07-24
Forum posts: 24
Re: Problem with List box (please help)

Thanks yaar. Done with that problem, but now facing another problem. Sad

I have 2 listboxes. When i select an item from 1st listbox, my 2nd listbox pops up (for showing more details abt selected item in 1st list box). I also done for displaying 2nd listbox.

But the problem is that, when i tries to scroll 2nd list, automatically 1st list comes up. (means on scrolling 2nd list, immediatelly, intems from 1st list get displayed on the screen)

Thanks.

Mon, 2007-07-30 08:14
Joined: 2006-04-19
Forum posts: 148
Re: Problem with List box (please help)

Hi

are you using the same array to display the items of 2nd listbox ... If yes then in OfferKeyEventL pls reset your array. Use these

Reset(); Compress(); This is working fine for me....

BR
Isha


"To the question of your life , you are the only Answer. To the problems of your life,you are the only Solution".

Mon, 2007-07-30 08:57
Joined: 2007-07-24
Forum posts: 24
Re: Problem with List box (please help)

Thanks for your help, isha.

I solved that problem.

I used "delete iListBox_1" while creating 2nd list. & now 2nd lisr can work properly

Thanks everybody

  • Login to reply to this topic.