×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    Grid view problem

    I write a program use a grid view.When I run the program ,I see all the 9 icons as the first icon only.
    Anyone knows what's the source of the problem?
    Here is my code:

    TBuf< KLengthOfPathEikonMbm > pathAppMbm;
    iCoeEnv->ReadResource( pathAppMbm, R_AKNEXGRID_PATH_AKNEXGRID_MBM );
    CArrayPtr< CGulIcon >* icons
    = new(ELeave) CAknIconArray(KNumberOfBitmap);
    CleanupStack::PushL( icons );
    CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsView_web);
    CleanupStack::PushL( bitmap );
    CFbsBitmap* bitmap1 = iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsBookmark);
    CleanupStack::PushL( bitmap1 );


    CFbsBitmap* bitmap2= iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsHistory);
    CleanupStack::PushL( bitmap2);



    CFbsBitmap* bitmap3 = iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsSearch);
    CleanupStack::PushL( bitmap3 );



    CFbsBitmap* bitmap4 = iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsSetting);
    CleanupStack::PushL( bitmap4 );


    CFbsBitmap* bitmap5 = iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsHelp);
    CleanupStack::PushL( bitmap5 );


    CFbsBitmap* bitmap6 = iEikonEnv->CreateBitmapL( pathAppMbm, EMbmIconsAbout);
    CleanupStack::PushL( bitmap6 );



    icons->AppendL( CGulIcon::NewL( bitmap,NULL) );
    icons->AppendL( CGulIcon::NewL( bitmap1,NULL) );
    icons->AppendL( CGulIcon::NewL( bitmap2,NULL) );
    icons->AppendL( CGulIcon::NewL( bitmap3,NULL) );
    icons->AppendL( CGulIcon::NewL( bitmap4,NULL) );
    icons->AppendL( CGulIcon::NewL( bitmap5,NULL) );
    icons->AppendL( CGulIcon::NewL( bitmap6,NULL) );



    CleanupStack::Pop(); // bitmap
    CleanupStack::Pop();
    CleanupStack::Pop();
    CleanupStack::Pop();
    CleanupStack::Pop();
    CleanupStack::Pop();
    CleanupStack::Pop();
    iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
    CleanupStack::Pop(); // icons array

    Thanks in advance,

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    23

    RE: Grid view problem

    I think the problem is not in the icon list. because every item of the listbox has a number field which indicate the index of the icon in the icon list. By the way I think you can create your icon list use these codes :
    CArrayPtr< CGulIcon >* icons = new(ELeave) CAknIconArray(KNumberOfBitmap);
    CleanupStack::PushL( icons );
    icons->AppendL( iEikonEnv->CreateIconL( pathAppMbm, EMbmIconsX,EMbmIconsXMask ) );
    .
    .
    .
    iGrid->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
    CleanupStack::Pop();

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    8

    Have fix?

    I've the same problem. Have you ever found a fix for it?

    Thanks
    Tn

  4. #4
    Registered User
    Join Date
    Apr 2003
    Location
    Portugal
    Posts
    23
    As faqff pointed out in is post, the problem is not the code.
    The problem is that you have to specify in the text array the icon index you want to use in that cell.

    You associate an icon array with the grid and then you associate a string array.

    Each element in this string array has a format like "1\tItem 1", where 1 is the index of the image you want to use from the icon array (0-based) and Item 1 is the text you want to use as label. These two fields are separated by a TAB character (\t)

    If you have the same icon for all the grid cells, you must be using the same icon index for all of them.

Posting Permissions

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