CaretPos in Pixels

General TRichView support forum. Please post your questions here
Post Reply
samuelredekop
Posts: 2
Joined: Tue Nov 06, 2007 12:21 pm

CaretPos in Pixels

Post 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
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

EM_POSFROMCHAR is not supported.
As for displaying menu at the caret position, see the demo
Demos\Delphi\Assorted\AutoComplete\
samuelredekop
Posts: 2
Joined: Tue Nov 06, 2007 12:21 pm

Post by samuelredekop »

Thank you VERY MUCH. I was searching for the GetCaretPos( TPoint ) :lol:
Now is working, thanks...
Post Reply