Page 1 of 1

CaretPos in Pixels

Posted: Tue Nov 06, 2007 12:51 pm
by samuelredekop
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 :D

Posted: Tue Nov 06, 2007 1:21 pm
by Sergey Tkachenko
EM_POSFROMCHAR is not supported.
As for displaying menu at the caret position, see the demo
Demos\Delphi\Assorted\AutoComplete\

Posted: Tue Nov 06, 2007 3:07 pm
by samuelredekop
Thank you VERY MUCH. I was searching for the GetCaretPos( TPoint ) :lol:
Now is working, thanks...