How to draw string without using Draw()

Login to reply to this topic.
Tue, 2006-09-26 08:44
Joined: 2006-07-07
Forum posts: 1
Hi Experts,

Can anybody tell me that how to draw string, image etc apart from Draw() function.

Actually in my application i am requesting to server for data and i want to show message to user when server has finished work. So user can continue. For this i want to show some message to user but dont want to use DrawNow() because it call Draw() and i dont want to call Draw().

I heard about some functon BeginDraw() and EndDraw() but how to use them?

Please help me. Smiley

Thanks in advance
Kuldeep

Tue, 2006-09-26 09:44
Joined: 2006-05-10
Forum posts: 64
Re: How to draw string without using Draw()
Hi,

  Try this:
Code:
...
CWindowGc &gc = SystemGc();
gc.Activate( Window() );
gc.UseFont( iCoeEnv->NormalFont() );
gc.DrawText( ptext, TPoint( 10, 20 ) );
gc.Deactivate();
...

Regards,

  Damian

Confusion will be my epitaph..

Tue, 2006-09-26 10:00
Joined: 2006-04-13
Forum posts: 34
Re: How to draw string without using Draw()
Hi!
U wanna inform the user na.. then use information note after server finishes the work.

_LIT(KMessage,"The Message");
CAknInformationNote* informationNote = new (ELeave)   
                                                            CAknInformationNote;
informationNote->ExecuteLD(KMessage);

Hope this helps u  Smiley

Regards,
Shilpa K


Tue, 2006-10-31 10:23
Joined: 2005-11-30
Forum posts: 11
Re: How to draw string without using Draw()
Hi Damian

I m drawing some text in draw function , working fine, but I want to draw my text in my own custom function i.e. want to redraw the text. that is giving error WSERV 9.

TRied ur idea -

gc.Activate( Window() );
....
gc.Deactivate();

Not giving any error but not drawing any contentes alos...
can u plz advise?
Tue, 2006-10-31 11:22
Joined: 2006-05-10
Forum posts: 64
Re: How to draw string without using Draw()
Hi,

  Are you calling your own function from Draw()? If not, you have to call ActivateGc() before and DeactivateGc() after calling your own function, cause the standard graphics context needs to be activated and deactivated manually (in case of Draw() function these methods are called by the framework).
  If this is not the case, please provide some more information or source code.

Hope this helps,
  Damian

Confusion will be my epitaph..

Tue, 2006-10-31 13:56
Joined: 2005-11-30
Forum posts: 11
Re: How to draw string without using Draw()
Hi Damian,

Thanks very much for your reply. It helped me alot but my problem is not solved yet.
I am calling my function from CMyAppUi as -
Code:
void CMyAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
{
iAppContainer->DrawMyText(_L("Hello My Text"));
break;
}
        case EEikCmdExit:
            {
            Exit();

break;
            }


and the problem is this is working only with case EAknSoftkeyBack, on other menu items it is not showing any thing.
my Draw function is -
Code:
void CMyContainer::DrawMyText(const TDesC &aText)
{
ActivateGc();
m_BufDrawText.Zero();
m_BufDrawText.Copy(aText);

CWindowGc &gc = SystemGc();
gc.Activate( Window() );
gc.UseFont( iCoeEnv->NormalFont() );
gc.DrawText( m_BufDrawText, TPoint( 30, 30 ) );
gc.Deactivate();
DeactivateGc();
}



for gc.Activate( Window() ); ....gc.Deactivate(); It is giving WSERV 10.


I want to work my DrawMyText() with any menu commmand...

hope u can help

thanks
Wed, 2006-11-01 07:18
Joined: 2005-11-16
Forum posts: 62
Re: How to draw string without using Draw()
Hi prj,
        here is the description for WSERV 10 panic
Quote
Attempted to activate an already active graphics context.

On the server side, this is raised by CWsGc::Activate() as a response to a EWsGcOpActivate request.

The request is sent by the client-side method CWindowGc::Activate().

I think you can comment the codes
gc.Activate( Window() ); and
gc.Deactivate();
and try....
hope this helps..
regards
Badshah
Wed, 2006-11-01 07:47
Joined: 2005-11-30
Forum posts: 11
Re: How to draw string without using Draw()
O sorry Badshah ,

Actully that gc.Activate( Window() ); and gc.Deactivate(); is commented only, I just forgot to put the comment before putting in to forum.
ActivateGc();
DeactivateGc();
is working well but on system keys only like EAknSoftkeyBack not on my menu command

Thu, 2006-11-02 09:49
Joined: 2006-05-10
Forum posts: 64
Re: How to draw string without using Draw()
Hi,

  I suggest you should take a look at helloworldplus example from Series60Ex. There is a custom draw method:
Code:
void CHelloWorldPlusAppView::UserDraw() const
However, behaviour you've described is strange. Could you show how (and where) are you invoking your custom draw method when it's not working?

Regards,
  Damian

Confusion will be my epitaph..

  • Login to reply to this topic.