Carnegie
April 30th, 1999, 09:49 AM
I'm trying to write a routine to update the text in a CEdit control as it is being typed. For example, typing:
'#A' will produce the text 'Audit' in the edit control.
I can update the text, but I am unable to reset the position of the caret after using the SetWindowText() function to update the window text. Regardless of where I set the caret, it always appears at the very beginning of the edit control.
I'm using the following code to obtain and set the caret position:
index = CharFromPos( GetCaretPos());
CEdit::OnChar(nChar, nRepCnt, nFlags);
GetWindowText( newtext );
Substition routine converts 'newtext' to 'buffer' and updates the value of index to reflect the new text position.
SetWindowText( buffer );
SetCaretPos( PosFromChar( index ));
Is there another way to update the text in the edit control without using Get/SetWindowText?
Carnegie
'#A' will produce the text 'Audit' in the edit control.
I can update the text, but I am unable to reset the position of the caret after using the SetWindowText() function to update the window text. Regardless of where I set the caret, it always appears at the very beginning of the edit control.
I'm using the following code to obtain and set the caret position:
index = CharFromPos( GetCaretPos());
CEdit::OnChar(nChar, nRepCnt, nFlags);
GetWindowText( newtext );
Substition routine converts 'newtext' to 'buffer' and updates the value of index to reflect the new text position.
SetWindowText( buffer );
SetCaretPos( PosFromChar( index ));
Is there another way to update the text in the edit control without using Get/SetWindowText?
Carnegie