KeyPreview property

  • Thread starter Thread starter Patrick de Ridder
  • Start date Start date
P

Patrick de Ridder

"Forms provide a Boolean KeyPreview property. If you set this to true, your
form receives key press events when any of its controls have focus, and it
receives these events before the control does. This technique is useful if
you are programming a customized interface or a game where you need to take
complete control of the keyboard."

Could someone please explain with a simple example. I tried, but couldn't.

Many thanks.
 
Benny Mathew said:

by the way, i've tried to use that in my application to catch the Esc key
but it seems to work randomly and to be eventually quite useless: if a .NET
control has the focus, the form receive the Key event first as excpected but
if an ActiveX control has the focus (such as the web browser activex), the
form sometimes never receives key events. Nothing in the doc about that.
Very disapointing.
 
Back
Top