Solved

Send KeyStrokes to controls

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

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

15 Experts available now in Live!

Get 1:1 Help Now