Solved

Send KeyStrokes to controls

Posted on 1998-12-20
4
476 Views
Last Modified: 2011-09-20
I'm trying to program a Delphi-CodeInsight-like feature for my word-processor. I's just going well, I've got a listbox that shows at the cursorpos of my richedit-control. Now I'd like the selection of the listbox to change when the user presses the cursor up and down keys, but the other key should be sent to the richedit-component. Well, all in one, I'd just like to be able to send keystrokes to controls!
Does someone have a solution for this problem? I'm sure this isn't too hard, but I'm just too lazy to find out by myself, so get the bucks!
0
Comment
Question by:Metty
  • 3
4 Comments
 

Author Comment

by:Metty
ID: 1352289
In addition to the functions above I want to set the SelectedItem of the ListBox to the Item, which matches the input best, so I want to send the pressed keys both to the Editor and the ListBox.
0
 
LVL 3

Accepted Solution

by:
Matvey earned 50 total points
ID: 1352290
Just use TControl.Perform:

  memo1.Perform(WM_CHAR, 70, 0);
  memo1.Perform(WM_KEYDOWN, VK_DOWN, 0);

The first one sends the message of the letter 'F' to the memo, and the seccond one send a "down arrow" message.

--Matvey
0
 

Author Comment

by:Metty
ID: 1352291
Ok, give me some time to check it and if the whole thing works, the points are yours!
0
 

Author Comment

by:Metty
ID: 1352292
That's it!

Thanxx.
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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
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…

914 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

19 Experts available now in Live!

Get 1:1 Help Now