×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    22

    Problem with CEikRichTextEditor

    Hi All,
    I'm still quite new in symbian and I have problem with CEikRichTextEditor. I've created a class class CRTextEditor : public CEikRichTextEditor and inside this class I have a method
    Code:
    void CRTextEditor::AddTextL(const TDesC& aText)
    {
    	CRichText* richText = RichText();
    	TInt documentLength = richText->DocumentLength();
    	richText->InsertL(documentLength, aText);
    	richText->ApplyCharFormatL(iCharFormat,iCharFormatMask,documentLength, aText.Length());
    	HandleTextChangedL();
    }
    Then in ConstructL I do:
    Code:
    _LIT(name,"String 1 ");
    CreateWindowL();
    iEditor->AddTextL(name);
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC(reader, R_RICHTEXTEDITOR);
    CRTextEditor* iEditor = new (ELeave) CRTextEditor();
    iEditor->SetContainerWindowL(*this);
    iEditor->AddTextL(name);
    CleanupStack::PopAndDestroy();
    SetRect(aRect);
    ActivateL();
    I have now two problems. Firsly when I delete
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC(reader, R_RICHTEXTEDITOR);
    what is for me not necessary my emulator is terminated and nothing happens. Second I have error in line iEditor->AddTextL(name):
    illegal access from 'CRTextEditor' to protected/private member 'CRTextEditor::AddTextL(const TDesC16 &)'.
    Please help.

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    370

    Re: Problem with CEikRichTextEditor

    Firsly when I delete
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC(reader, R_RICHTEXTEDITOR);
    what is for me not necessary my emulator is terminated and nothing happens.
    You need not delete reader variable, as it is T-based variable, which means no memory is allocated to it.
    Your Resource memory is stored on heap and its pointer is pushed on Cleanup Stack, which you need to delete.
    For that you can call PopAndDestroy(). Something like this
    Code:
                TResourceReader reader;
                iCoeEnv->CreateResourceReaderLC( 
                        reader, resourceReaderId );
                iMenu->ConstructFromResourceL( reader );
                CleanupStack::PopAndDestroy(); // reader
    illegal access from 'CRTextEditor' to protected/private member 'CRTextEditor::AddTextL(const TDesC16 &)'.
    Please help.
    Have you put AddTextL as private/protected member function of CRTextEditor?
    If so, you would not be able to access this. As you are creating an object of CRTextEditor.
    Probably you should do something like this
    Code:
    *<Youclass>.h
    CEikRichTextEditor* iEditor; 
    *<Youclass>.cpp
    <Youclass>::constructL(){
    iEditor = CEikRichTextEditor::NewL();
    AddTextL();
    }
    
    <Youclass>::AddTextL(){
    iEditor->SetTextL();
    }
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    22

    Re: Problem with CEikRichTextEditor

    I've made some changes but I still have the same problem namely my emulator is terminated. My Code now

    Code:
    void CHelloAppView::ConstructL(const TRect& aRect)
    	{
    		_LIT(name,"String 1 ");
    		CreateWindowL();
    		CRTextEditor* iEditor;
    		iEditor = CRTextEditor::NewL();
    		iEditor->SetContainerWindowL(*this);
    		iEditor->AddTextL(name);
    		CleanupStack::PopAndDestroy();
    		SetRect(aRect);
    		// Activate the window, which makes it ready to be drawn
    		ActivateL();
    	}
    The same is when I add TResourceReader. What am I doing wrong?

Similar Threads

  1. Problem With CEikRichTextEditor??
    By gmsk19 in forum Symbian User Interface
    Replies: 6
    Last Post: 2008-06-11, 08:09
  2. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  3. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  4. 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
  5. CEikRichTextEditor problem with Cut and Copy.
    By skdas in forum Symbian C++
    Replies: 0
    Last Post: 2003-06-05, 13:18

Posting Permissions

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