CRichEditCtrl -- current column?
-
In my MDI MFC app, I have a status bar pane that shows the current line number and column number. I know that to get the current line number, I simply do: int lineNumber = LineFromChar( -1 ). But I am having trouble getting the current column, anyone know how to do this? It shouldn't be too bad.
-
In my MDI MFC app, I have a status bar pane that shows the current line number and column number. I know that to get the current line number, I simply do: int lineNumber = LineFromChar( -1 ). But I am having trouble getting the current column, anyone know how to do this? It shouldn't be too bad.
I believe something like this would work. If ctrl is your control and lineNumber is the current line number:
int GetColumn(int lineNumber) { // start will be char index of cursor long start, end; ctrl.GetSel(start, end); // LineIndex gives char index of beginning of current line return (start - ctrl.LineIndex(lineNumber)); }