×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    53

    CEikRichTextEditor

    Hi!

    I am trying create a CEikRichTextEditor where I can display some data. After few hours search, I found some instructions:

    http://journey.schlabo.com/paper/p09_richtext.php

    and followed them... I tried to set some text in the editor but nothing is shown. I used SetText and InsertL...

    Is there something else that I have to take care of?
    Do I have to use CTextView, CTextLayout or CRichText classes?

    Any help appreciated!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144
    here's an small example:

    Put this into your containers ConstructL() function:

    TCharFormat charFormat;
    TCharFormatMask charFormatMask;

    charFormat.iFontSpec = LatinBold17()->FontSpecInTwips();
    charFormatMask.SetAll();

    iPformUser = CParaFormatLayer::NewL();
    iCformUser = CCharFormatLayer::NewL(charFormat,charFormatMask);
    iRTextUser = CRichText::NewL(iPformUser,iCformUser);

    iRTextUser->InsertL(iRTextUser->LdDocumentLength(),UserName);

    iGTEdUser = new (ELeave) CEikRichTextEditor;
    iGTEdUser->SetContainerWindowL(*this);
    iGTEdUser->ConstructL(this,10,0,EAknEditorFlagDefault,EGulFontControlAll,EGulAllFonts);
    iGTEdUser->SetBorder(TGulBorder::ESingleBlack);
    iGTEdUser->SetRect(TRect(22,45,156,70));
    iGTEdUser->SetDocumentContentL(*iRTextUser);
    iGTEdUser->SetFocus(ETrue);
    iGTEdUser->ClearSelectionL();

    and implement these two functions:

    TInt CMyContainer::CountComponentControls() const
    {
    if(iGTEdUser)
    return 1;
    else
    return 0;
    }

    CCoeControl* CDCam_StartView::ComponentControl(TInt aIndex) const
    {
    return iGTEdUser;
    }

  3. #3
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    53

    Now it works!

    Thanks again Yucca...

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    9
    To my experience, if you don't care about the formatting, simply use SetTextL in the base class. However, a CRichText object allows you apply rich text formatting information, like font, style, color, etc.
    -Dan

Posting Permissions

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