Tedit caret and char position
Posted on 1997-05-26
I am making my own editor as an array of single line TEdit boxes.
I need to be able to move the caret (cursor position) from one line to
another when the user presses the down arrow key.
The functions GetCaretPos and SetCaretPos work correctly as expected
however when the user presses a key for new input it appears in the Edit
at the last position that the caret was at. Not where I have the caret
I am using a system font (all characters the same size).
e.g. Say I have the caret between the Y and X on line 2 below. Then I use
mouse and go to a position between D and E on line 1. If I press down
I can position the caret between the V and U as required. If I now enter a
Say Q it will appear between the Y and X NOT between the V and U that I
Line 1 ABCDEF
Line 2 ZYXVUW
How do I get around this problem?
Below is my MoveCursorDown function
void TMyView::MoveCursorDown(int iCurrentEditCntIdx)
if(iCurrentEditCntIdx < iNbrEditControls - 1)
EditCnt[iCurrentEditCntIdx + 1]->SetFocus();
EditCnt[iCurrentEditCntIdx + 1]->SetCaretPos(point);
Thanks in anticipation of a reply