×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    178

    Question CEikRichTextEditors messed up

    I got two richtexteditors, one is for input and one is for output. Everything else works just fine, but when I add text to messagewindow and do following code the input text is messed up:


    iOutputEditor->RichText()->Reset();

    // #1
    iOutputEditor->HandleTextChangedL();
    iOutputEditor->SetCursorPosL( 0, EFalse );


    // #2

    Why is that? When I replace #1 with "iInputEditor->SetFocus( EFalse, ENoDrawNow );" and #2 with "iInputEditor->SetFocus( ETrue, ENoDrawNow );" input editor's text almost stays as I would like it to be, but there is still some problems. Any ideas how to solve this?

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

    Re: CEikRichTextEditors messed up

    can you show us how both iInputEditor and iOutputEditor created...

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    178

    Re: CEikRichTextEditors messed up

    TCharFormat myTextFormat;
    TCharFormatMask formatMask;
    myTextFormat.iFontPresentation.iTextColor = KRgbDarkBlue;
    formatMask.SetAttrib( EAttColor );

    iOutputEditor= new (ELeave) CEikRichTextEditor();
    iOutputEditor->SetContainerWindowL( *this );
    TResourceReader reader;
    iEikonEnv->CreateResourceReaderLC(
    reader, R_OUTPUT_WINDOW );
    iOutputEditor->ConstructFromResourceL( reader );
    CleanupStack::PopAndDestroy(); // reader internal state
    iOutputEditor->RichText()->SetInsertCharFormatL( myTextFormat, formatMask, iOutputEditor->RichText()->DocumentLength() );






    RESOURCE RTXTED r_output_window
    {
    numlines = 6;
    textlimit = 20;
    flags = EEikEdwinNoAutoSelection |
    EEikEdwinJustAutoCurEnd |
    EEikEdwinDisplayOnly |
    EEikEdwinReadOnly |
    EEikEdwinAvkonDisableCursor;

    default_case = EAknEditorTextCase;
    allowed_case_modes = EAknEditorAllCaseModes;
    numeric_keymap = EAknEditorStandardNumberModeKeymap;
    default_input_mode = EAknEditorTextInputMode;
    allowed_input_modes = EAknEditorTextInputMode |
    EAknEditorNumericInputMode |
    EAknEditorSecretAlphaInputMode |
    EAknEditorKatakanaInputMode |
    EAknEditorFullWidthTextInputMode |
    EAknEditorFullWidthNumericInputMode |
    EAknEditorFullWidthKatakanaInputMode |
    EAknEditorHiraganaKanjiInputMode |
    EAknEditorHalfWidthTextInputMode;
    special_character_table = 0;
    max_view_height_in_lines = 10;
    avkon_flags = EAknEditorFlagNoEditIndicators |
    EAknEditorFlagEnableScrollBars;
    }



    Input is same, except resource is changed:

    RESOURCE RTXTED r_input_field
    {
    textlimit = 255;
    flags = EEikEdwinNoAutoSelection |
    EEikEdwinNoWrap |
    EEikEdwinNoHorizScrolling;
    default_case = EAknEditorTextCase;
    allowed_case_modes = EAknEditorAllCaseModes;
    numeric_keymap = EAknEditorStandardNumberModeKeymap;
    default_input_mode = EAknEditorTextInputMode;
    allowed_input_modes = EAknEditorTextInputMode |
    EAknEditorNumericInputMode |
    EAknEditorSecretAlphaInputMode |
    EAknEditorKatakanaInputMode |
    EAknEditorFullWidthTextInputMode |
    EAknEditorFullWidthNumericInputMode |
    EAknEditorFullWidthKatakanaInputMode |
    EAknEditorHiraganaKanjiInputMode |
    EAknEditorHalfWidthTextInputMode;
    special_character_table = 0;
    max_view_height_in_lines = 1;
    }
    Last edited by ManuMies; 2008-06-17 at 17:44.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    44

    Re: CEikRichTextEditors messed up

    Quote Originally Posted by ManuMies View Post
    I got two richtexteditors, one is for input and one is for output. Everything else works just fine, but when I add text to messagewindow and do following code the input text is messed up:


    iOutputEditor->RichText()->Reset();

    // #1
    iOutputEditor->HandleTextChangedL();
    iOutputEditor->SetCursorPosL( 0, EFalse );


    // #2

    Why is that? When I replace #1 with "iInputEditor->SetFocus( EFalse, ENoDrawNow );" and #2 with "iInputEditor->SetFocus( ETrue, ENoDrawNow );" input editor's text almost stays as I would like it to be, but there is still some problems. Any ideas how to solve this?
    #include<Editor_container.h>
    void CEditorContainer::ConstructL(void)
    {
    CreateWindowL();

    SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect());

    CreateEditorL();

    ActivateL();
    }

    void CEditorContainer::CreateEditorL(void)
    {
    iEditor = new (ELeave) CEikRichTextEditor;
    iEditor->SetAknEditorFlags(EAknEditorFlagEnableScrollBars);
    iEditor->SetContainerWindowL(*this);
    iEditor->SetAvkonWrap(ETrue);
    iEditor->ConstructL(this,0,0,0);

    iEditor->SetFocus(ETrue);
    iEditor->EnableCcpuSupportL(ETrue);
    iEditor->SetCursorPosL(0, EFalse);
    iEditor->SetAvkonWrap(ETrue);

    TFontSpec fontspec = LatinBold16()->FontSpecInTwips();
    TCharFormat charFormat( fontspec.iTypeface.iName, fontspec.iHeight );
    TCharFormatMask charFormatMask;

    charFormat.iFontPresentation.iTextColor = KRgbBlack;
    charFormatMask.SetAttrib(EAttColor);

    charFormatMask.SetAttrib(EAttFontTypeface);
    charFormatMask.SetAttrib(EAttFontHeight);
    iEditor->ApplyCharFormatL(charFormat, charFormatMask);

    iEditor->UpdateScrollBarsL();
    SizeChanged();
    }


    CEditorContainer::~CEditorContainer()
    {
    delete iEditor;
    }

    void CEditorContainer::HandleResourceChange(TInt aType)
    {
    TRect rect;

    if ( aType==KEikDynamicLayoutVariantSwitch )
    {
    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
    SetRect(rect);
    }

    CCoeControl::HandleResourceChange(aType);
    }

    void CEditorContainer::SizeChanged()
    {
    TRect rect = Rect();

    if(iEditor)
    {
    #ifdef __SERIES60_3X__
    TRect ScrollBarRect = iEditor->ScrollBarFrame()->
    VerticalScrollBar()->Rect();
    iEditor->SetExtent(TPoint(0,StatusLineHeight),
    TSize(rect.Width()-ScrollBarRect.Width(), rect.Height()-StatusLineHeight));
    #else
    iEditor->SetExtent(TPoint(0,StatusLineHeight),
    TSize(rect.Width(), rect.Height()-StatusLineHeight));
    #endif
    }
    }

    TInt CEditorContainer::CountComponentControls() const
    {
    if(iEditor)
    {
    return 1;
    }
    else
    {
    return 0;
    }
    }

    CCoeControl* CEditorContainer::ComponentControl(TInt /*aIndex*/) const
    {
    return iEditor;
    }

    void CEditorContainer:raw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear();
    }

    TKeyResponse CEditorContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,
    TEventCode aType)
    {
    TKeyResponse Ret(EKeyWasNotConsumed);

    if (iEditor)
    {
    Ret = iEditor->OfferKeyEventL(aKeyEvent, aType);
    }

    return Ret;
    }

    void CEditorContainer::SetEditorTextL(const TDesC& aText)
    {
    if (iEditor)
    {
    iEditor->ClearSelectionL();
    iEditor->RichText()->Reset();

    iEditor->RichText()->InsertL(0,aText);
    iEditor->RichText()->InsertL(iEditor->RichText()->
    LdDocumentLength(),CEditableText::ELineBreak);

    iEditor->UpdateScrollBarsL();
    iEditor->DrawNow();
    }
    }

    you can see this code.I think you should set the position of inpu and output in function Sizechanged().

  5. #5
    Registered User
    Join Date
    Oct 2007
    Posts
    178

    Re: CEikRichTextEditors messed up

    I actually handle SizeChanged() already and the problem is with HandleTextChanged (and SetCursorPos?). Gotta try to change HandleTextChanged to DrawNow. Again, the problem is, if I do HandleTextChanged to OUTPUT editor, the another editor gets fucked up.

  6. #6
    Registered User
    Join Date
    Oct 2007
    Posts
    178

    Unhappy Re: CEikRichTextEditors messed up

    Ok, I now tried DrawNow, but it causes etext12 (cursor out of document) error.

    So does anyone have an idea WHY handletextchanged affects on other editor too?

  7. #7
    Super Contributor
    Join Date
    Sep 2007
    Posts
    1,005

    Re: CEikRichTextEditors messed up

    replace #1 with "iOutputEditor->SetFocus( ETrue, ENoDrawNow );" and #2 with "iOutputEditor->SetFocus( EFalse, ENoDrawNow );"
    "iInputEditor->SetFocus( ETrue, ENoDrawNow );"

Similar Threads

  1. Messed up threads
    By Symbian_Neil in forum News and Announcements
    Replies: 3
    Last Post: 2007-10-18, 08:41
  2. Console fonts messed up
    By savago in forum Open C/C++
    Replies: 5
    Last Post: 2007-09-08, 18:45
  3. Setting Item List messed up in landscape mode
    By developer_who in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-06-20, 19:38
  4. Replies: 4
    Last Post: 2007-02-19, 16:48

Posting Permissions

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