Solved

AutoCompletion

Posted on 2004-04-04
4
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML text in the body of an email (delphi code) 12 210
Firemonkey webbrowser scrollbars ? 1 57
enhance the following code 3 42
Firemonkey Tcameracomponent resultion 1 23
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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