Solved

Send KeyStrokes to controls

Posted on 1998-12-20
4
477 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

816 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