CaretPos in Pixels
Posted: Tue Nov 06, 2007 12:51 pm
I need to put a Intellisense system on TRichViewEdit. But there can be different sizes (width and height), images, etc. So, how i get the correct position of Caret in pixels? (like the position of window when Ctrl+Spaced on Delphi).
With RichEdit i've used:
var
__P2 : TPoint;
begin
__RichEdit1.Perform(EM_POSFROMCHAR, Longint(@P2), RichEdit1.SelStart);
__Button1.Left := P2.x;
__Button1.Top := P2.y;
end;
then i got the position on my P2, but it doesn't works with TRichViewEdit:
var
__P2 : TPoint;
begin
__RichViewEdit1.Perform(EM_POSFROMCHAR, Longint(@P2), RVGetLinearCaretPos(RichViewEdit1));
__Button1.Left := P2.x;
__Button1.Top := P2.y;
end;
always return 0...
i'm doing something wrong? Can someone help me?
Thanks
With RichEdit i've used:
var
__P2 : TPoint;
begin
__RichEdit1.Perform(EM_POSFROMCHAR, Longint(@P2), RichEdit1.SelStart);
__Button1.Left := P2.x;
__Button1.Top := P2.y;
end;
then i got the position on my P2, but it doesn't works with TRichViewEdit:
var
__P2 : TPoint;
begin
__RichViewEdit1.Perform(EM_POSFROMCHAR, Longint(@P2), RVGetLinearCaretPos(RichViewEdit1));
__Button1.Left := P2.x;
__Button1.Top := P2.y;
end;
always return 0...
i'm doing something wrong? Can someone help me?
Thanks