×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    46

    How to Highlight item in ListBox.........

    Hi all,

    I have a Listbox with three items...
    When i select an item i want the selected item to be highlighted.
    But i am unable to do this...
    Below is the code snippet
    Any pointers on how to highlight the selected item.....
    iArray = new (ELeave) CDesC16ArrayFlat(3);

    iArray->AppendL(_L("ITEM1"));

    iArray->AppendL(_L("ITEM2"));

    iArray->AppendL(_L("ITEM3"));

    iListbox = new (ELeave) CEikTextListBox();

    //iListbox->SetMopParent(this);

    iListbox->ConstructL(this,EEikListBoxPaintedSelection|EEikListBoxNoExtendedSelection);//SLafListBox::EItemPaintedSelection);

    iListbox->SetContainerWindowL(*this);

    iListbox->SetListBoxObserver(this);

    iListbox->Model()->SetItemTextArray(iArray);

    iListbox->HandleItemAdditionL();

    TRect rect(TPoint(20,50),TPoint(200,150));//iListbox->MinimumSize());

    iListbox->SetRect(rect);

    iListbox->SetCurrentItemIndex(1);

    iListbox->CreateScrollBarFrameL(ETrue);

    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);



    Thanks in advance.....

  2. #2
    Super Contributor
    Join Date
    May 2004
    Posts
    2,265
    //iListbox->SetCurrentItemIndex(1);
    iListbox->SetCurrentItemIndexAndDraw(1);

Posting Permissions

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