Solved

AutoCompletion

Posted on 2004-04-04
4
297 Views
Last Modified: 2010-05-18
This is a little difficult to explain.

Okay, basically, you know in Delphi where you type Form1. and a little box pops up and gives you a list of possible valid autocompletions?

Well, I'm trying to implement something similar. In an RxRichEdit control, if someone tries to autocomplete something, I want a little box to popup and give them a list of possible completions.

Well, I've done most of it, I just need a little help. So far I've done it as a nonbordered form with a virtual string tree component for the list, now all I need to do is get the top/left values for the form so it can popup where the keyboard cursor is..

I have no clue how to do this and I have searched high and low.

Any help would be appreciated greatly.
0
Comment
Question by:DelphiAddict
  • 2
4 Comments
 

Author Comment

by:DelphiAddict
ID: 10752436
Keyboard caret not cursor. Sorry.
0
 
LVL 11

Expert Comment

by:ZhaawZ
ID: 10752970
You can use function GetCaretPos(var lpPoint : TPoint) to get relative position (top/left) of cursor (caret) in active component.
0
 
LVL 11

Accepted Solution

by:
ZhaawZ earned 200 total points
ID: 10753001
var
  p : TPoint;
begin
GetCaretPos(p);
p := RxRichEdit.ClientToScreen(p);
(* p.X will be absolute left position of caret, p.Y - top position of caret. Now these could be also top/left values for the form *)
end;
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10753514

procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  pt : TPoint;
begin
 GetCaretPos(pt);
 pt :=  RxRichEdit.ClientToScreen(pt);
 PopUpMenu1.PopUp(pt.x, pt.Y);
end;

Shane
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Dbf export problem to a Visual Foxpro application 6 160
Delphi application Soap connection 5 94
oracle global variables 4 63
Create a path if not exists 7 68
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
A short film showing how OnPage and Connectwise integration works.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now