Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User TeachMe's Avatar
    Join Date
    Mar 2006
    Posts
    13
    Hello Nokia forum User,

    I am developing one project using CEikRichTextEditor , but I am facing some problems.

    (1) I am getting a white background . If we can change then would we able to change the white to some other user defined color. (I would be happy if I am able to get a transparent background)
    (2) The font color is green in color by default. How can v change this .
    (3) I have given in OfferKeyEventL (.. Page/Line up movement for the cursor, evenif only the last line gets folded by itself. No movement by page/line .

    Pls help me by providing some useful tips and stuffs

    Thanks in advance
    with regards.

  2. #2
    Regular Contributor bitnir's Avatar
    Join Date
    Mar 2003
    Posts
    101
    1) Check that your code supports themes. You AppUi ConstructL code should start like this:

    BaseConstructL(EAknEnableSkin);

    // Create view object
    iAppView = CYourView::NewL( ClientRect() );
    iAppView->SetMopParent(this);
    AddToStackL(iAppView);

    Your container should contain following variable:
    MAknsControlContext* iBackGround; // for skins support

    Your container needs to create iBackGround in ConstructL:
    iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );

    And you need to implement background drawinf in your containers Draw-function:
    void CYourView::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
    AknsDrawUtils::Background( skin, cc, this, gc, aRect );
    }

    After this all contained controls should be "transparent" by default.

    2) I'll just copy some of my code here:
    TCharFormat check;
    TCharFormatMask charFormatMask;
    const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont);

    AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont);
    check.iFontSpec = font->FontSpecInTwips();
    charFormatMask.SetAttrib(EAttFontStrokeWeight);
    charFormatMask.SetAttrib(EAttFontPosture);
    charFormatMask.SetAttrib(EAttFontUnderline);
    charFormatMask.SetAttrib(EAttColor);
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    TRgb textcol;
    AknsUtils::GetCachedColor(skin,textcol,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6);
    --> check.iFontPresentation.iTextColor = TLogicalRgb(textcol);

    text->ApplyCharFormatL(check,charFormatMask,iEditor->CursorPos(),aText.Length());

    This sets the color that theme developer has suggested to be the main pane text color. Just change the line marked with an arrow to change the text color to any value you wish. (this code contains some unnecessary stuff for your use, just use the bits you need)

    3) Could you clarify your question?

  3. #3
    Registered User TeachMe's Avatar
    Join Date
    Mar 2006
    Posts
    13
    Hello,

    I was able to solve the 3rd problem

    thanks
    Last edited by TeachMe; 2006-05-06 at 09:04.

  4. #4
    Registered User TeachMe's Avatar
    Join Date
    Mar 2006
    Posts
    13
    Quote Originally Posted by bitnir
    Your container needs to create iBackGround in ConstructL:
    iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
    Hello BitNir,

    I have done as you said. But for the first line itself it works fine. ( That too an editor created thru resource.) If I trid to create an editor by coding , its background will not be transparent.

    Where is the variable iBackGround further called. I don't know .Pls clarify my doubts.

    Thanks in advance

  5. #5
    Registered User madhurjya.pb's Avatar
    Join Date
    Mar 2008
    Location
    India
    Posts
    26
    Quote Originally Posted by bitnir View Post
    1) Check that your code supports themes. You AppUi ConstructL code should start like this:

    BaseConstructL(EAknEnableSkin);

    // Create view object
    iAppView = CYourView::NewL( ClientRect() );
    iAppView->SetMopParent(this);
    AddToStackL(iAppView);

    Your container should contain following variable:
    MAknsControlContext* iBackGround; // for skins support

    Your container needs to create iBackGround in ConstructL:
    iBackGround = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );

    And you need to implement background drawinf in your containers Draw-function:
    void CYourView::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
    AknsDrawUtils::Background( skin, cc, this, gc, aRect );
    }

    After this all contained controls should be "transparent" by default.

    2) I'll just copy some of my code here:
    TCharFormat check;
    TCharFormatMask charFormatMask;
    const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont);

    AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont);
    check.iFontSpec = font->FontSpecInTwips();
    charFormatMask.SetAttrib(EAttFontStrokeWeight);
    charFormatMask.SetAttrib(EAttFontPosture);
    charFormatMask.SetAttrib(EAttFontUnderline);
    charFormatMask.SetAttrib(EAttColor);
    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
    TRgb textcol;
    AknsUtils::GetCachedColor(skin,textcol,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6);
    --> check.iFontPresentation.iTextColor = TLogicalRgb(textcol);

    text->ApplyCharFormatL(check,charFormatMask,iEditor->CursorPos(),aText.Length());

    This sets the color that theme developer has suggested to be the main pane text color. Just change the line marked with an arrow to change the text color to any value you wish. (this code contains some unnecessary stuff for your use, just use the bits you need)

    3) Could you clarify your question?

    Hey bitnir,

    I tried as you said to make the background transparent for a CEikRichTextEditor. But its not working for me. Could you kindly tell me if I need to change somewhere else also to make it done ?..

    With thanks

  6. #6

  7. #7
    Registered User madhurjya.pb's Avatar
    Join Date
    Mar 2008
    Location
    India
    Posts
    26
    Quote Originally Posted by kulvijay View Post


    Hi kulvijay,

    Thanks. It works, and solved my problem.

Similar Threads

  1. Background image in CEikEdwin or CEikRichTextEditor
    By sberserker in forum Symbian User Interface
    Replies: 2
    Last Post: 2012-08-02, 12:02
  2. CEikRichTextEditor, background colour and 3rd Edition
    By mark_williams in forum Symbian User Interface
    Replies: 5
    Last Post: 2007-01-29, 14:33
  3. Replies: 1
    Last Post: 2006-04-27, 18:10
  4. How to make background transparent?
    By oslario in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-08-04, 07:56
  5. Replies: 2
    Last Post: 2005-06-08, 09:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved