×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    108

    how to use CEikColumnListBox

    hi,
    i want to create a listbox with 2 text columns. i seem t be able to create a CEikColumnListBox, but dont know how to specify the number of columns and how to append data into a particular location in the CEikColumnListBox. also, i dont want to use the resource file. below is the code of what i am doing...

    iStdLbx = new(ELeave) CEikColumnListBox;
    iStdLbx->SetMopParent(this);
    iStdLbx->ConstructL(NULL, CEikListBox::ECreateOwnWindow | CEikListBox::EMultipleSelection | CEikListBox::ENoExtendedSelection);
    iStdLbx->SetExtent(TPoint(top,left), TSize(width,height));

    //populate
    CTextListBoxModel* aModel= iStdLbx->Model();
    MDesCArray* itemList = aModel->ItemTextArray();
    CDesCArray* itemArray = (CDesCArray*)itemList;

    itemArray->AppendL(_L("aaaa"));///<--- how to add to a particular location?
    itemArray->AppendL(_L("bbbb"));
    itemArray->AppendL(_L("cccc"));
    //--------------
    iStdLbx->HandleItemAdditionL();
    iStdLbx->ActivateL();


    thanks,
    ash

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    108

    RE: how to use CEikColumnListBox

    did it.. thanks anyway guys. heres the code if you need it

    TInt flags( /*CEikListBox::EPopout |*/ CEikListBox::ELeftDownInViewRect );
    iColLbx = new( ELeave ) CEikColumnListBox;
    iColLbx->SetContainerWindowL(*this);


    iColLbx->ConstructL( this, flags );

    iColLbx->SetExtent(TPoint(0,0), TSize(150,160)); //listbox size
    CDesCArray* itemArray = STATIC_CAST( CDesCArray*,iColLbx->Model()->ItemTextArray() );

    CColumnListBoxData* columnData = iColLbx->ItemDrawer()->ColumnData();
    columnData->SetColumnWidthPixelL( 0, 30 ); //1st col
    columnData->SetColumnWidthPixelL( 1, 68 ); //2nd col

    itemArray->AppendL(_L("1\taaaaa"));
    itemArray->AppendL(_L("2\tbbbbb"));
    itemArray->AppendL(_L("3\tccccc"));

    iColLbx->HandleItemAdditionL();
    iColLbx->SetFocus(ETrue);
    iColLbx->ActivateL();

Posting Permissions

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