×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    cannot draw mbm, am i missing something?

    I try to edit the example given in Symbian\7.0s\Series60_v20_CW\Examples\Graphics\ws\bitmapsprite....

    i edit the draw method like this (so i can draw a bitmap)

    void CMainWindow:raw(const TRect& aRect)
    {
    CWindowGc* gc=SystyemGc();
    gc->Clear(aRect);
    TSize size = Window().Size();

    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(bitmap);
    User::LeaveIfError(bitmap->Load(_L("*"),0));
    gc->DrawBitmap(Tpoint(0,0),0);

    CleanupStack::PopAndDestroy();
    }

    the above code is what i did on draw method... I got no error and was able to build it successfully. But its not drawing the bitmap that i need... Is the code enough or am i missing of something? Please help me...

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

    Re: cannot draw mbm, am i missing something?

    you should really load the bitmap inside the Draw function, simply because it is supposed to be non-leaving function.

    Anyway, you need to spcify the drive+path+filename when using the load function, othervise it will return error, and also you should give the bitmap in the DrawBitmap function..

    yucca

  3. #3
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by symbianyucca
    you should really load the bitmap inside the Draw function, simply because it is supposed to be non-leaving function.

    Anyway, you need to spcify the drive+path+filename when using the load function, othervise it will return error, and also you should give the bitmap in the DrawBitmap function..

    yucca
    yeah, i've read some example that

    User::LeaveIfError(bitmap->Load(_L("*"),0));

    is also equals to <pathofyourmbm>nameOfApp.mbm...


    and also you should give the bitmap in the DrawBitmap function..
    I CAN'T GET THIS PART, can you explain it to me...

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    92

    Re: cannot draw mbm, am i missing something?

    Hi xersmith,

    Just compare and test this one.

    void CMainWindow:raw(const TRect& aRect)
    {
    CWindowGc* gc=SystyemGc();
    gc->Clear(aRect);
    TSize size = Window().Size();

    TFileName bitmapFile
    _LIT(KIconFile, "\\system\\apps\\myprj\\myPrj.mbm");

    bitmapFile.Append(KIconFile);


    User::LeaveIfError (CompleteWithAppPath (bitmapFile));


    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(bitmap);

    User::LeaveIfError(bitmap->Load(bitmapFile,0));

    TSize bitmapSize = bitmap->SizeInPixels();
    TPoint topLeft((aRect.Width() - bitmapSize.iWidth)/2,(aRect.Height() - bitmapSize.iHeight)/2);

    gc.DrawBitmap(TRect(topLeft, bitmapSize), bitmap);


    CleanupStack::PopAndDestroy();
    }


    Hope this will help you

    Thanks and Regards,
    Yogesh

  5. #5
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by xersmith

    I CAN'T GET THIS PART, can you explain it to me...
    The function DrawBitmap has the following Declaration.
    virtual void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);

    Specify the bitmap you want to draw in aSource. Dont give it as 0.

  6. #6
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by yogesh.bhople
    Hi xersmith,

    Just compare and test this one.

    void CMainWindow:raw(const TRect& aRect)
    {
    CWindowGc* gc=SystyemGc();
    gc->Clear(aRect);
    TSize size = Window().Size();

    TFileName bitmapFile
    _LIT(KIconFile, "\\system\\apps\\myprj\\myPrj.mbm");

    bitmapFile.Append(KIconFile);


    User::LeaveIfError (CompleteWithAppPath (bitmapFile));


    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
    CleanupStack::PushL(bitmap);

    User::LeaveIfError(bitmap->Load(bitmapFile,0));

    TSize bitmapSize = bitmap->SizeInPixels();
    TPoint topLeft((aRect.Width() - bitmapSize.iWidth)/2,(aRect.Height() - bitmapSize.iHeight)/2);

    gc.DrawBitmap(TRect(topLeft, bitmapSize), bitmap);


    CleanupStack::PopAndDestroy();
    }


    Hope this will help you

    Thanks and Regards,
    Yogesh
    Hi yogesh,

    i don't know what i need in this function
    CompleteWithAppPath
    Hope you make your reply soon... Thanks

    Been trying your given code... but

  7. #7
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by xersmith
    Hi yogesh,

    i don't know what i need in this function


    Hope you make your reply soon... Thanks

    Been trying your given code... but
    Examples:
    1). TFilename fname = _L("\testdir\pics.mbm");
    CompleteWithAppPath ( fname );

    Result: fname == "c:\testdir\pics.mbm" if application was installed to c:

    2).TFilename fname = _L("pics.mbm");
    CompletePathWithAppPath( fname );

    Result: fname == "c:\system\apps\myapp\pics.mbm" if application was installed to c:

  8. #8
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    Re: cannot draw mbm, am i missing something?

    I get it, so even ommitting that line of code it will still work?

    . . . well i just ommitted that line and was able to build the app successfully, but still the bmp was not drawn. . .

    Please help me... Or if you have an simple application there that draws a bmp, please share... I just really want to study it... PLEASE!!!!

  9. #9
    Registered User
    Join Date
    Aug 2006
    Posts
    92

    Re: cannot draw mbm, am i missing something?

    Hi XerSmith,

    Make sure that you add .mbm file in your .Pkg file

    and you added .mbg file in your .cpp file.

    Thanks And Regards,
    Yogesh

  10. #10
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by xersmith
    I get it, so even ommitting that line of code it will still work?

    . . . well i just ommitted that line and was able to build the app successfully, but still the bmp was not drawn. . .

    Please help me... Or if you have an simple application there that draws a bmp, please share... I just really want to study it... PLEASE!!!!
    Hi,

    Can you please elaborate on what is the problem you are facing?
    Is it crashing, leaving or simply not displaying?

    Have a look at the bitmaps example: \Symbian\8.0a\S60_2nd_FP2\Examples\graphics\bitmaps

  11. #11
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    Re: cannot draw mbm, am i missing something?

    Hi Tina!

    Quote Originally Posted by Tina_Tibrewal
    Hi,

    Can you please elaborate on what is the problem you are facing?
    Is it crashing, leaving or simply not displaying?

    Have a look at the bitmaps example: \Symbian\8.0a\S60_2nd_FP2\Examples\graphics\bitmaps
    Its not crashing nor leaving.. it simply not displaying the bitmap that i need. Its been properly configured and built in my mbm file, but still its not being drawn.

    Actually the example im using is this

    Symbian\7.0s\Series60_v20_CW\Examples\Graphics\ws\bitmapsprite
    (the one with rotating cross... something like that)

    More help i need

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

    Re: cannot draw mbm, am i missing something?

    Note that there is a far better example in 2nd edition SDK-s: check Symbian\7.0s\Series60_v20_CW\Series60Ex\graphics.
    Ooops, late :-)

  13. #13
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by wizard_hu_
    Note that there is a far better example in 2nd edition SDK-s: check Symbian\7.0s\Series60_v20_CW\Series60Ex\graphics.
    Ooops, late :-)
    I've tried that example, the one with two balls (red and blue, i think), but when i test it in the emulator the application just simply close... I've been trying to debug it but getting frustrated, can't build it...

    Help me more... Please!!!

  14. #14
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: cannot draw mbm, am i missing something?

    Which tool (CodeWarrior, Carbide.c++ or Carbide.vs) are you using?

  15. #15
    Regular Contributor
    Join Date
    Dec 2006
    Posts
    161

    Re: cannot draw mbm, am i missing something?

    Quote Originally Posted by wizard_hu_
    Which tool (CodeWarrior, Carbide.c++ or Carbide.vs) are you using?
    carbide.c++.

    I've been trying to debug it but getting frustrated, can't build it...
    Sorry i was wrong with this part... CANT RUN IT, not can't build it... I was able to build the application successfully, but in the emulator, when i click ok the application runs then closes after...

Similar Threads

  1. Problem with Cabride.c++ v1.1
    By markovuksanovic in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 3
    Last Post: 2007-01-24, 20:05
  2. Problem of using MIF and MBM together in 3.0
    By lukedau in forum Symbian User Interface
    Replies: 6
    Last Post: 2006-09-27, 17:29
  3. MMS SDK : missing transaction id header
    By vincent.czerniak in forum General Messaging
    Replies: 1
    Last Post: 2006-01-27, 07:53
  4. Dynamic loading and converting to MBM
    By whitemoon in forum Symbian User Interface
    Replies: 3
    Last Post: 2003-11-04, 04:39
  5. missing mbm file
    By vyom_garg in forum Symbian
    Replies: 2
    Last Post: 2003-04-29, 09:49

Posting Permissions

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