|
-
January 17th, 2007, 10:54 AM
#7
Re: Cursor Position in Edit Control
Maybe this helps:
int pos1,pos2;
m_editControl->GetSel(pos1,pos2); /// this returns the position of the caret in characters
// After this you can get the string with GetWindowText
// i used it to simulate Ctrl+Enter when Enter only was pressed.
CString t;
m_editControl->GetWindowText(t);
t.Insert(pos1,'\r');
t.Insert(pos1+1,'\n');
m_editControl->SetWindowText(t);
m_editControl->SetSel( pos1+2,pos1+2,FALSE); // set the caret after the two new characters \r and \n
I hope this helps.
(sorry for my english)
bye.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|