×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    45

    Problem with DrawText..

    Hi,

    my problem is:

    when I'm reading form file to TBuf8, like this:
    TBuf8<10> readBuf8;
    myFile.Read(0,readBuf8);

    I want to print it to screen by DrawText(),
    So I convert the TBuf8 to TBuf16 like this:
    TBuf16<10>readBuf16;
    readBuf16.Copy(readBuf8).

    and when I'm trying to print it using DrawText like this:
    gc.DrawText(readBuf16,TPoint(10,20))
    i'm getting error..

    what to do?
    How to make it printing?
    Thanks..

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Problem with DrawText..

    Hello,
    what error do you get?

    Have you defined font?
    for example like this in Draw function:
    Code:
    const CFont *ourFont3=CEikonEnv::Static()->DenseFont();
    gc.UseFont(ourFont3);

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    45

    Re: Problem with DrawText..

    Is I defined it:
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.UseFont(iCoeEnv->NormalFont());
    gc.SetPenColor(KRgbYellow);

    The error im getting is:
    expression syntax error
    on this line: gc.SetPenStyle(CGraphicsContext::ENullPen);
    but if I delete that line i'm getting the same error on the other line (gc.SetPenColor..)

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Problem with DrawText..

    Quote Originally Posted by gb0071 View Post
    Is I defined it:
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.UseFont(iCoeEnv->NormalFont());
    gc.SetPenColor(KRgbYellow);

    The error im getting is:
    expression syntax error
    on this line: gc.SetPenStyle(CGraphicsContext::ENullPen);
    but if I delete that line i'm getting the same error on the other line (gc.SetPenColor..)
    can you show us your total function and the coammndline out put.

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: Problem with DrawText..

    anyway, if you want to draw text, why would you have a null pen there, would it be better to use solid pen instead.

  6. #6
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Problem with DrawText..

    change "iCoeEnv" to "iEikonEnv"
    Amit Kankani
    Nokia Developer Champion

  7. #7
    Registered User
    Join Date
    Mar 2009
    Posts
    45

    Re: Problem with DrawText..

    change it to iEikonEnv..
    still getting same error.
    what to do?

  8. #8
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Problem with DrawText..

    I guess this is a GUI application right ?

    as said show the complete Draw function and command line output where the error is shown !!!
    Amit Kankani
    Nokia Developer Champion

  9. #9
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Problem with DrawText..

    With this code i can without any problem draw text:

    Code:
    void MyApp::Draw(const TRect& aRect) const
    	{
    	CWindowGc& gc = SystemGc();
    	gc.Clear( aRect );
    	const CFont *ourFont3=CEikonEnv::Static()->DenseFont();
    	gc.UseFont(ourFont3);
            gc.SetPenColor(iFontColor);
            gc.DrawText(iDrawText, TPoint(iPosX, iPosY));
    	}
    where
    Code:
    TRgb iFontColor;
    TBuf<32> iDrawText;// you can set size what you want
    TInt iPosX,iPosY;

  10. #10
    Registered User
    Join Date
    Jun 2008
    Location
    India
    Posts
    1,048

    Re: Problem with DrawText..

    Quote Originally Posted by gb0071 View Post
    Is I defined it:
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.UseFont(iCoeEnv->NormalFont());
    gc.SetPenColor(KRgbYellow);

    The error im getting is:
    expression syntax error
    on this line: gc.SetPenStyle(CGraphicsContext::ENullPen);
    but if I delete that line i'm getting the same error on the other line (gc.SetPenColor..)
    have you tried nuker85 code to set font.?

Similar Threads

  1. Problem with CAknDoubleStyleListBox with a CAknSearchField
    By jjig in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-09-17, 00:58
  2. Problem with DrawText()
    By gowthamgowtham in forum Symbian C++
    Replies: 3
    Last Post: 2008-02-24, 12:19
  3. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  4. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

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