When using a TRichedit I've also used the following code to get the Line and column so they can be displayed in the StatusBar. I'd like to do the same for a TMemo, but EM_EXLINEFROMCHAR requires Richedit in the uses clause and it's seems like overkill to have to include it just for this one message. Is there a comparable way of handling this for a TMemo?
procedure TEditFrA.UpdateCursorPos(Sender: TObject); var CharPos: TPoint; begin CharPos.Y := SendMessage(FrMemo.Handle, EM_EXLINEFROMCHAR, 0, FrMemo.SelStart); CharPos.X := (FrMemo.SelStart - SendMessage(FrMemo.Handle, EM_LINEINDEX, CharPos.Y, 0)); Inc(CharPos.Y); Inc(CharPos.X); Editor.LineColStatPane.Caption := InttoStr(CharPos.Y) + '/' + InttoStr(CharPos.X); end; from Robert Meek dba Tangentals Design CCopyright 2006 Proud to be a moderator of "The Delphi Lists" at elists.org "When I examine myself and my methods of thought, I come to the conclusion that the gift of Fantasy has meant more to me then my talent for absorbing positive knowledge!" Albert Einstein _______________________________________________ Delphi mailing list -> Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi