×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    18

    cannot create icons from avkon.mbm

    Hello,

    I want to create some icons for check box, and my code is as follow:
    const TInt KNumberOfIcons=3;
    _LIT(KMbmPath ,"z:\\resource\\apps\\avkon2.mbm");
    CArrayPtr<CGulIcon>* icons = new(ELeave)CAknIconArray(KNumberOfIcons);
    icons->AppendL (iEikonEnv->CreateIconL(KMbmPath,EMbmAvkonQgn_prop_checkbox_on,EMbmAvkonQgn_prop_checkbox_on_mask));
    icons->AppendL (iEikonEnv->CreateIconL(KMbmPath,EMbmAvkonQgn_prop_checkbox_off,EMbmAvkonQgn_prop_checkbox_off_mask));
    icons->AppendL (iEikonEnv->CreateIconL(KMbmPath,EMbmAvkonQgn_prop_checkbox_off,EMbmAvkonQgn_prop_checkbox_off_mask));

    I cannot find avkon.mbm, so I use avkon2.mbm instead (I don't know if they are the same).
    when I run the code, I always get System Error (-1001). I think the problem is that the icon cannot be created.
    I'm not very sure what this error means. Does it mean Bad image or unsupported format?
    I run the code in my emulator, and I don't know exactly where "z:\\system\\data\\" is. Is it in "C:\Symbian\9.2\S60_3rd_FP1\Epoc32\Data\z\resource\apps"?

  2. #2
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: cannot create icons from avkon.mbm

    This link has some similar discussion :
    http://discussion.forum.nokia.com/fo...ad.php?t=70839

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    18

    Re: cannot create icons from avkon.mbm

    Quote Originally Posted by vasant21 View Post
    This link has some similar discussion :
    http://discussion.forum.nokia.com/fo...ad.php?t=70839
    Thanks for your information,
    but it doesn't work.
    I do use the path of "z:\\resource\\apps\\avkon2.mbm".
    I always get the error message like "System Error (-1001)".
    The exception is thrown from the first icon creation.
    icons->AppendL (iEikonEnv->CreateIconL(KMbmPath,EMbmAvkonQgn_prop_checkbox_on,EMbmAvkonQgn_prop_checkbox_on_mask));
    But I don't know why.

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    18

    Re: cannot create icons from avkon.mbm

    The problem has been solved.
    Thank you, vasant21.
    Last edited by icoming; 2008-05-24 at 14:27.

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    6

    Re: cannot create icons from avkon.mbm

    what is the solution?

  6. #6
    Regular Contributor
    Join Date
    May 2007
    Posts
    52

    Re: cannot create icons from avkon.mbm

    Hi guys

    I researched all related topics, but still can't get bitmap from avkon2.mbm

    At last my test I have used 2 types of code:
    1)

    AknIconUtils::CreateIconL(iIndicator, iIndicatorMask,
    AknIconUtils::AvkonIconFileName(),
    EMbmAvkonQgn_indi_marked_grid_add,
    EMbmAvkonQgn_indi_marked_grid_add_mask);
    Here AknIconUtils::AvkonIconFileName() returns Z:\Resource\Apps\avkon2.mbm, this function is not leaved but unfortunately iIndicator and iIndicatorMask don't bring real bitmaps. At least iIndicatorMask/Indicator->SizeInPixels() = 0.

    2) Also I have used next code:
    iIndicator = iEikonEnv->CreateBitmapL(AknIconUtils::AvkonIconFileName(), EMbmAvkonQgn_prop_signal_icon);
    iIndicatorMask = iEikonEnv->CreateBitmapL(AknIconUtils::AvkonIconFileName(), EMbmAvkonQgn_prop_signal_icon_mask);
    But there I received System error -1001.

    So still path is incorrect or what ?


    Can you help how to resolve it.

    Thanks in advance.

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: cannot create icons from avkon.mbm

    Re-test the first variant, and invoke AknIconUtils::SetSize.
    With the introduction of scalable UI, the file extension .mbm as automatically replaced with .mif when the icon ID-s happen to be greater than 16384.
    And if you check EMbmAvkonQgn_indi_marked_grid_add, it is 16478, thus the icon is a scalable one (.svg in avkon2.mif), and it has no size until you set it.

    CreateBitmapL might not be prepared to handle this situation correctly.

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: cannot create icons from avkon.mbm

    Absolutely to demo here is the code
    Code:
    CFbsBitmap* bitmap;
    CFbsBitmap* mask;
    AknIconUtils::CreateIconL( bitmap, mask, KAvkonBitmapFile, EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask );
    
    TSize sizeToSet;
    AknIconUtils::PreserveIconData( bitmap );
    AknIconUtils::GetContentDimensions( bitmap, sizeToSet );
    AknIconUtils::SetSize( bitmap, sizeToSet,EAspectRatioPreserved);
    AknIconUtils::SetSize( mask, sizeToSet,EAspectRatioPreserved);
    AknIconUtils::DestroyIconData( bitmap );
    Now your bitmap and mask are good to know.

    KAvkonBitmapFile is defined in aknconsts.h as _LIT(KAvkonBitmapFile, "z:\\resource\\apps\\avkon2.mbm");

    You can change the icon id to the ones that you want.

    Cheers,
    Mayank

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: cannot create icons from avkon.mbm

    The "AknIconUtils::SetSize( mask, sizeToSet,EAspectRatioPreserved);" line is not necessary:
    Quote Originally Posted by SDK Help
    Note that this call sets the sizes of both bitmap and mask (if it exists), regardless of which is given as the parameter

  10. #10
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: cannot create icons from avkon.mbm

    Quote Originally Posted by wizard_hu_ View Post
    The "AknIconUtils::SetSize( mask, sizeToSet,EAspectRatioPreserved);" line is not necessary:
    Ah missed it out somehow, thanks for pointing it out, time for me to make that change in the code too, coz I think I am doing that all the places. Would make things a lil faster, avoiding a func call :-)

    Cheers,
    Mayank

  11. #11
    Regular Contributor
    Join Date
    May 2007
    Posts
    52

    Re: cannot create icons from avkon.mbm

    Hi, guys

    Thank you very much for replies. My mistake was I didn't invoke AknIconUtils::SetSize(). Now it works, I can load system bitmaps from avkon2.mbm.
    So conclusion:
    1) To load system bitmaps, we shall call AknIconUtils::CreateIconL(), and as 3rd input param - file path, it is better provide AknIconUtils::AvkonIconFileName() to avoid any misunderstanding with correct path.
    2) In case using scalable bitmap (as wizard told it is icons which iD-s are greater than 16384) it needs to invoke AknIconUtils::SetSize() obviously.

    Btw, I have next issue. Is it possible to display system icon with the same properties (size, transparency, etc) as it is displayed by Symbian UI engine. I.e. when I loaded bitmap EMbmAvkonQgn_prop_signal_icon (you can see this icon here: http://alindh.iki.fi/symbian/avkon.mbm/) it is displayed with some default properties (I suppose, as it is saved in memory), but I wonna render this icon exactly how user see in usual UI screen.

    Thanks in advance.

  12. #12
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: cannot create icons from avkon.mbm

    AknLayoutUtils can help you getting rectangles of various screen components.

  13. #13
    Regular Contributor
    Join Date
    May 2007
    Posts
    52

    Re: cannot create icons from avkon.mbm

    Thanks, wizard_hu_, for help.

    I have tried AknLayoutUtils and it indeed allows to get rectangle of different panes. But I want to know exact position of prop signal icon. And unfortunately I can't detect that, I just know signal pane rectangle (ESignalPane), but it is another.

    My application runs in background, is invisible for user and at the same time it sends some data time to time via GPRS to server, so correspondingly GPRS icon is appeared instead of prop signal icon and of course I want to hide this GPRS icon to not confuse an user :). So I decided to redraw prop signal icon with the same properties as it is displayed by default.

    Hence I have 2 questions:
    1) Is it possible to know prop signal rectangle, color and other properties.
    2) Regarding Symbian Signing. Does Symbian allow to product such application, which "changes" some standard UI, exactly GPRS notification? Does this application pass Symbian Signed Test Criteria?

    Thanks
    *strutv

  14. #14
    Regular Contributor
    Join Date
    May 2007
    Posts
    52

    Re: cannot create icons from avkon.mbm

    Just update how I resolved questions raised above:

    1) Is it possible to know prop signal rectangle, color and other properties.
    I used one trick suggested by wizard_hu_, used CWsScreenDevice::CopyScreenToBitmap. You can see discussion here: http://discussion.forum.nokia.com/fo...945#post594945

    2) Regarding Symbian Signing. Does Symbian allow to product such application, which "changes" some standard UI, exactly GPRS notification? Does this application pass Symbian Signed Test Criteria?
    I have opened new thread to discuss that, please see results here: http://discussion.forum.nokia.com/fo...939#post594939

    *strutv

Similar Threads

  1. List boxes with icons
    By koreson in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-11-12, 19:15
  2. How to place flash-made icons in S60 Theme Studio?
    By heylife in forum Streaming and Video
    Replies: 0
    Last Post: 2006-03-21, 12:06
  3. Problem with listbox + icons
    By bojolex in forum Symbian
    Replies: 0
    Last Post: 2006-01-18, 11:28
  4. how to create a grid
    By ddhungry in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-11-27, 08:08

Posting Permissions

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