Easy... get the x,y in characters of the memo
function getCharacterPosition( aMemo: TMemo ): TPoint
begin
Result.X := LongRec( SendMessage( aMemo.Handle, EM_GETSEL, 0, 0 ) ).Hi;
Result.Y := SendMessage( aMemo.Handle, EM_LINEFROMCHAR, Result.X, 0 );
Result.X := Result.X - SendMessage(aMemo.Handle, EM_LINEINDEX, -1, 0);
return Result;
end;
and get the x,y in pixels of the memo
function getCharPositionInPixels( aMemo: TMemo ): TPoint
var result: TPoint;
begin
result := aMemo.Perform( EM_POSFROMCHAR, WPARAM(@result),
aMemo.SelStart);
return result;
end
Not sure if the code is error free, though but are these api messages ;-)
Yours,
Weyert de Boer
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders