03-10-04, 03:30 #1Registered User
- Join Date
- Feb 2004
Unanswered: Delphi Component to control keypress event
I am searching for a DELPHI (version 3 to 7) component that can control the keypress event on a form. No matter where is the focus, we still can get the respond everytime we press the keyboard key.
Normally, this is how it goes. I have to put a procedure in a keypress event of every components that I've been used in the form. This is a big hassle.
So, in order to remove this hassle, I need the component that can behave like what I described in the first paragraph.
Just give me the name of the component.
I appreciate anybody that can help and thanks in advance.
03-12-04, 17:39 #2Registered User
- Join Date
- Mar 2004
What you want to do is quite easy.
From the Delphi help topic for "Keyboard event processing order":
Keyboard events are received at several levels:
The application level, with an Application.OnMessage event.
You will rarely need to intercept keystrokes at the application level, but it is important to know that this first level is available.
The "shortcut-key" level
When you specify a shortcut key, such as those provided as a property of menu items, the keystroke is intercepted before the form sees it.
The form level
The form contains a KeyPreview property that enables you to code "global" keystroke events.
The component level
When you program key-press event handlers at the component level, the component with focus intercepts the keystroke.