×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    9

    Angry SVG icon can't display in Listbox on 3rd

    I have searched this forum and NewLC but got no right answer. Can anyone help me with following problem? Very urgent!

    I want to display a CAknDoubleGraphicStyleListBox with SVG icons. On the phone screen I can see all text in listbox but no icon. I am sure my MIF file has no problem. I post my code below. Can someone kindly let me know what is wrong with my code?

    void CMyContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL( );

    iDesArray = new (ELeave) CDesCArrayFlat( 10 );

    _LIT( KItemFormat, "0\tTitle\tContent\t" );
    for( TInt i=0; i<10; i++ )
    {
    TBuf<256> item;
    item.Copy( KItemFormat );
    iDesArray->AppendL( item );
    }

    iconList = new (ELeave) CAknIconArray( 1 );

    _LIT(KIconMifFileName, "C:\\resource\\apps\\myicons.mif");
    TFileName *filePath = new (ELeave) TFileName;
    CleanupStack::PushL( filePath );
    filePath->Copy( KIconMifFileName );

    AknIconUtils::CreateIconL( bitmap, mask, *filePath, EMbmMyiconIdex0, EMbmMyiconIdex0 );

    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
    icon->SetBitmapsOwnedExternally( ETrue );
    iconList->AppendL( icon );

    CleanupStack::PopAndDestroy( filePath );

    iListBox = reinterpret_cast<CAknColumnListBox *>(new (ELeave) CAknDoubleGraphicStyleListBox);
    iListBox->ConstructL( this );
    iListBox->SetContainerWindowL( *this );
    iListBox->CreateScrollBarFrameL( EFalse );
    iListBox->ScrollBarFrame( )->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
    iListBox->ItemDrawer( )->ColumnData( )->SetIconArray( iconList );
    iListBox->Model( )->SetItemTextArray( iDesArray );
    iListBox->Model( )->SetOwnershipType( ELbmOwnsItemArray );
    iListBox->SetRect( aRect );
    iListBox->SetListBoxObserver( this );
    iListBox->HandleItemAdditionL( );

    SetRect( aRect );
    ActivateL( );
    }

    void CMyContainer::SizeChanged( void )
    {
    if ( iListBox )
    {
    iListBox->SetRect( Rect( ) );
    iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize( ) );
    iListBox->ActivateL( );
    iListBox->DrawNow( );
    }
    }

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: SVG icon can't display in Listbox on 3rd

    In general it looks ok, thought I have never used the Gulicon with extenally owned bitmaps, so not actually sure if it would have any efect. Anyway, maybe you could try it without external bitmaps, and then basically just let the icon array to own the bitmaps completely.

    Then I would make the Mif file have the actual mask, so you could be certain it works ok (and maybe first try using monocrome mask). Then I would make sure that the index numbers are correct (i.e they are not zero-based, but the first number is a lot bigger than 0, either validate the index, or make the mgb header and use the right values from it).

    yucca

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    9

    Question Re: SVG icon can't display in Listbox on 3rd

    Thank you, Yucca.
    i found something very strange. If I changed CAknDoubleGraphicStyleListBox to CAknSingleGraphicStyleListBox, everything is perfect and icons are displayed. It seems the icons could not work with CAknDoubleGraphicStyleListBox.
    Really strange.

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: SVG icon can't display in Listbox on 3rd

    Basically, just noticed the casting... Could you remove the casting to the CAknColumnListBox, it might be that it could cause the listbox to use wrong overload of the icon setting function, which could then cause the SetSize()-not be called for the icons, thus your icons would stay at Size(0,0), and of course then they wouldn't be shown at all.

    yucca

Similar Threads

  1. Display problem in second listbox???
    By chandantheracer in forum Symbian
    Replies: 1
    Last Post: 2007-04-18, 12:19
  2. Replies: 1
    Last Post: 2006-12-07, 02:44
  3. Listbox Display
    By shilpav in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-11-08, 07:37
  4. how to add items to a ListBox with doulbe line and large icon?
    By liuajie in forum Symbian User Interface
    Replies: 2
    Last Post: 2002-11-22, 04:59
  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
  •