×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224

    Creating a dynamic list with icon and text.

    Hi,

    I am creating a dynamic list with icon and text. Icons are from the mbm files. Texts are received from the server side.

    {
    iListBox = new (ELeave) CAknSingleGraphicStyleListBox;
    iListBox->SetContainerWindowL(*this);
    iListBox->ConstructL(this, 0);
    iListBox->SetRect(aRect.Size());
    iListBox->ActivateL();
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()
    ->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
    iListBox->SetDimmed(ETrue);

    HBufC* iconFileName;
    iconFileName = StringLoader::LoadLC(R_ICON_FILE_NAME); // Pushes iconFileName onto the Cleanup Stack.

    // Create an array of icons, reading them from the file
    CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(KNumberOfIcons);
    CleanupStack::PushL(icons);
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmSimplelist1player, EMbmSimplelist1player_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmSimplelist2player, EMbmSimplelist1player_mask));
    CleanupStack::Pop(icons);
    CleanupStack::PopAndDestroy(iconFileName);
    iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);

    iMessageList = new (ELeave) CDesCArrayFlat(10);
    CTextListBoxModel* model = iListBox->Model();
    model->SetItemTextArray(iMessageList);
    model->SetOwnershipType(ELbmOwnsItemArray); // transfer ownership of iMessageList

    //For example, Test1, Test2 strings are received from the server side
    iMessageList->AppendL(_L("Test1"));
    iMessageList->AppendL(_L("Test2"));
    iListBox->HandleItemAdditionL();
    SetRect(aRect);
    ActivateL();
    MakeVisible(ETrue);

    }

    I really appreciate any help regarding this.

    Regards,
    shagor

  2. #2
    Super Contributor
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704

    Re: Creating a dynamic list with icon and text.

    Hi,

    All ur code is ok, except two lines for append to listbox items, ie.,

    iMessageList->AppendL(_L("Test1"));
    iMessageList->AppendL(_L("Test2"));

    in place of these two lines,
    iMessageList->AppendL(_L("0\t\Test1"));
    iMessageList->AppendL(_L("1\t\Test2"));

    0 & 1 are icon indexes in icon array


    this will helps to u

    regards,
    eswar

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224

    Re: Creating a dynamic list with icon and text.

    Hi eswar,

    Thanks. I already solved it a week ago. Anyway problem was in the String format.

Similar Threads

  1. List box - Series 80 - icon + text + double lines
    By k e k s in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-01-02, 10:49
  2. cannot reset fax icon
    By gfsmith in forum General Messaging
    Replies: 2
    Last Post: 2004-12-25, 12:19
  3. Replies: 1
    Last Post: 2004-03-01, 08:37
  4. Series 60 Listbox - how to move from one icon to another in a row
    By nitinkumar in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-07-08, 09:23
  5. Icon in column listbox does not appear
    By khanming in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-06-26, 12:46

Posting Permissions

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