Robert Meek wrote:
>       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;

You should get the same result using just EM_LINEFROMCHAR for a TMemo.

HTH

Stephen Posey
[EMAIL PROTECTED]

_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi

Reply via email to