hi everybody here,
I donnot konw how to judge whether the cursor is at the end of line in a CEikEdwin control when editing a note.
Is there any API of CEikEdwin or any method to figure it out?
Could someone help me? Any advise is appreciated!
hi everybody here,
I donnot konw how to judge whether the cursor is at the end of line in a CEikEdwin control when editing a note.
Is there any API of CEikEdwin or any method to figure it out?
Could someone help me? Any advise is appreciated!
You have to parse the text at the cursor position to know if it is a newline or not . No API available to known the newline at cursor position in CEikEdwin class.
Note: DO not Muti-Post.
There is no newline stored in the text.It's determined by the control when to start a newline,perhaps through the character number per text line.Because the amount of characters one line in CEikEdwin control is changable among different resolutions, so maybe the best way to solve this problem is using existing API of the control, now without API provided how can i code and keep it layout-independent?
In that case I can not really see what you expect. CEikEdwin can do word-wrapping automatically for you (that is the default behavior in fact), thus it is already layout-independent. What else do you need?
Anyway, if you really want to experiment, and do not care about FEP-transactions (for example it is a read-only editor), you can try something like this:Code:TInt pos=iEditor->CursorPos(); iEditor->MoveCursorL(TCursorPosition::EFLineEnd,EFalse); TBool endofline=pos==iEditor->CursorPos(); iEditor->SetCursorPosL(pos,EFalse);
Thank you so much for your reply.
The real situation is that I detected an error in my notepad program.After the user deleted the last line of a note whose content is longer than a page, the designer would expect the editor to roll down by one line, just as some programs with editor, e.g. Messaging,Contacts,etc. do for you. But in my notepad, the CEikEdwin just does not do this.I don't know why this happens. I have an observer of Notepad Editable window control and an editor dialog as the container, When an event happens, then it will be caught and sent to C***EventHandler, member function of my observer, to be handled.
Just like you said, it's usually the CEikEdwin's job to do that.But here it seems to do nothing, so i have to make a call to draw function to redraw the control in C***EventHandler when the very event occurred and then things become OK, I really don't know why it affects.Unfortunately it will result in many other bugs due to too much call to draw(almost every time a char is typed), hence i have to figure out another way to solve this problem or a better way to control the calling to draw function.
I posted this thread for figuring out the method,perhaps some condition statement, to identify the very event, the case Editor needs to roll down one line.then I just call the draw function under the condition i trapped in C***EventHandler and this could avoid calling the draw function too often and some bugs are also avoided.
Last edited by curiouswalker; 2008-07-06 at 14:35.
You can also try what CTextView::SetViewL really does (based on its documentation it could help if you specify last character of document, last line of the editor and EFViewBottomOfLine, but I have never seen it in action).