×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    50

    adding text to CEikEdwin or CEikGlobalTextEditor

    Hi,

    I see no funciton to add text to those text editors like 'append' .. i only see things like SetTextL, is there a way to append? Maybe someone experienced can give me some tips. I'm ttrying to to a chat program.

    Thanks.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    Hi

    you could have Richtext object in your class that has the content, you would then just add the stuff to the richtext and update it to the editor when needed.

    You could also take the editor text in HBuffer (see docs how to) and reAlloc that and then append.

    Or you could try just taking the pointer to the PlainText of the editor and try appending to it strait.

    yucca

  3. #3
    Registered User
    Join Date
    Mar 2003
    Location
    Gyor
    Posts
    236
    Hi,

    This is a kind of hand-made Append from sample codes:
    iRtEd->RichText()->InsertL(iRtEd->Text()->DocumentLength(),
    _L("."));

    CLR

  4. #4
    Regular Contributor
    Join Date
    Sep 2003
    Location
    Bangalore,India.
    Posts
    63

    work around

    Hi ThreeSixFiveOh,

    There is one method in CEikEdwin :
    CPlainText* Text() const;
    which gives a handle like thing to text part of edwin control.


    the following functions are available in CPlainText :
    //modifier functions
    IMPORT_C virtual void Reset();
    IMPORT_C virtual void InsertL(TInt aPos,const TChar& aChar);
    IMPORT_C virtual void InsertL(TInt aPos,const TDesC& aBuf);
    IMPORT_C virtual TBool DeleteL(TInt aPos,TInt aLength);

    So, u could use these to insert text at any position.

    To append text, use Text()->DocumentLength() as aPos in
    InsertL function.

    I hope this will solve your problem.

    Regards,
    Sreenivasulu Y

  5. #5
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    50
    Thanks everyone

    I'm now using CPlainText, it works.

    I have a small problem... here are my printing functions for the Global text editor.


    void CF2FBTContainer::Print(const TDesC& aText)
    {
    chatWindow->InsertL(iGTextEd->CursorPos(), aText);
    iGTextEd->SetCursorPosL(chatWindow->DocumentLength(), EFalse);
    iGTextEd->DrawNow();
    }

    void CF2FBTContainer::PrintLine(const TDesC& aText)
    {
    Print(aText);
    PrintNewLine();
    }


    void CF2FBTContainer::PrintNewLine()
    {
    TKeyEvent KeyEvent;
    TEventCode Type=EEventKey;
    KeyEvent.iCode=13;//Carrige return
    iGTextEd->OfferKeyEventL(KeyEvent,Type);
    //iGTextEd->SetCursorPosL(chatWindow->DocumentLength(), EFalse);
    iGTextEd->DrawNow();
    }


    Sometimes, calling PrintLine doesn't seem to cause a New Line to be printed. The next text appends to the end of the last instead on the same line.

    PrintLine() is called in a few ways..

    The simplest way
    iReporter.PrintLine(_L("Connecting to Server"));

    Another way:
    TBuf<30> printBuf;
    TBuf<2> tempPort; tempPort.Format(_L("%d"), channel);
    printBuf.Append(_L("Get port = "));
    printBuf.Append(tempPort);
    iReporter.PrintLine(printBuf);

    I've also tried
    TBuf<30> printBuf;
    printBuf.Format(_L("Get port = %d"), channel);
    iReporter.PrintLine(printLine);


    I think all the above work fine.

    However a new line is not printed when i used this:
    iReporter.PrintLine(_L("Connection error "));
    TBuf<F2F_ISTATUS_LENGTH> tmp; tmp.Format(_L("%d"), iStatus.Int());
    iReporter.PrintLine(tmp);

    Any string printed consequently using PrintLine is printed right after 'tmp' ... not on a new line..
    Any idea anyone?

  6. #6
    Registered User
    Join Date
    Oct 2003
    Location
    Philippines
    Posts
    24
    hi,

    can you give me the format on constructing an edwin? i am to use it to display sms contents. if you could guide me through the way.. thank you..

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    Hi diane_eight

    Have you checked the editor example ? it is showing all aspects needed to get edwins working, might be a good point to start solving your problems.

    yucca

Posting Permissions

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