Solved

AutoCompletion

Posted on 2004-04-04
4
296 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
Comment Utility
Keyboard caret not cursor. Sorry.
0
 
LVL 11

Expert Comment

by:ZhaawZ
Comment Utility
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
Comment Utility
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
Comment Utility

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

13 Experts available now in Live!

Get 1:1 Help Now