Solved

AutoCompletion

Posted on 2004-04-04
4
299 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

815 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

8 Experts available now in Live!

Get 1:1 Help Now