×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    9

    UserDraw does not draw?

    Ok, I'm trying to call my void COwnclassView::UserDraw() const method from my COwnclassUI.cpp via menu command with the following in the userdraw:
    Code:
    void CAnimAppView::UserDraw() const
    {
    
    CWindowGc& gc = SystemGc();
    TRect rect = Rect();
        
    ActivateGc();
    Draw(rect);
    	
    gc.Clear(rect);
    	
    const CFont* fontUsed = iEikonEnv->NormalFont();
    gc.SetPenColor(KRgbBlack);
    gc.UseFont(fontUsed);
    	
     _LIT(KWord, "Words");
    	 gc.DrawText(KWords, TPoint(100,30));
    	
    
    
    DeactivateGc();
    	
    }
    Nothing happens, what am I doing wrong?

    EDIT:

    It seems that when I call this userdraw from my animate method which is used with active object running, it draws the content when the active object gets stopped. I tried to stop it from the menu command, and that works, but calling userdraw after it just does nothing!?!? What should I call or set in order to make it draw?
    Last edited by zing; 2008-05-04 at 15:47.

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

    Re: UserDraw does not draw?

    would it be easier to just call DrawNow() and let the application framework take care of activation/deactivation, which would leave you code just the drawing in normal Draw() function.

  3. #3
    Super Contributor
    Join Date
    Feb 2008
    Location
    Belo Horizonte, Brazil
    Posts
    744

    Re: UserDraw does not draw?

    Yeah, just use the normal way:

    Code:
    void CAnimAppView::Draw(const TRect& aRect) const
        {
        CWindowGc& gc = SystemGc();
        gc.SetPenStyle( CGraphicsContext::ENullPen );
        gc.SetBrushColor( KRgbWhite);
        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
        gc.DrawRect( aRect );    
        gc.Clear( Rect() );
        const CFont* font = iEikonEnv->NormalFont();
        gc.UseFont( font );
        gc.DrawText( _L("Test!"), TPoint( 100,30 ));
        }
    
    void CAnimAppView::SizeChanged()
        {
        DrawNow();
        }

Similar Threads

  1. Replies: 0
    Last Post: 2008-04-15, 08:38
  2. Thread and Draw Command
    By vitormcruz in forum Symbian
    Replies: 3
    Last Post: 2007-11-01, 20:50
  3. Draw text on sprites/bitmaps...
    By erst in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-16, 15:05
  4. Replies: 2
    Last Post: 2007-04-04, 02:11
  5. Draw lines into EDWIN like in SMS app
    By stenlik in forum Symbian User Interface
    Replies: 6
    Last Post: 2006-11-30, 09:04

Posting Permissions

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