adding text to CEikEdwin or CEikGlobalTextEditor
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.
Nokia Developer Expert
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.
This is a kind of hand-made Append from sample codes:
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 :
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
I hope this will solve your problem.
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)
void CF2FBTContainer::PrintLine(const TDesC& aText)
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"));
TBuf<2> tempPort; tempPort.Format(_L("%d"), channel);
printBuf.Append(_L("Get port = "));
I've also tried
printBuf.Format(_L("Get port = %d"), channel);
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());
Any string printed consequently using PrintLine is printed right after 'tmp' ... not on a new line..
Any idea anyone?
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..
Nokia Developer Expert
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.