Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread KeyPreview / OnKeyDown etc .....
Sat, Aug 4 2012 1:33 PMPermanent Link

Mark Brooks

Slikware

Avatar

I have a question regarding keypress detection.

I am able to get the various events to trigger on key down / press / up BUT only if:

a) I have at least one "focusable" control on the form
b) A "focusable" control has "focus"

I have a form with no focusable controls, merely some TPanlels and TImages but want to perform certain actions when the up / down arrows are pressed.

Can this be achieved?

Cheers
Mark
Thu, Aug 9 2012 12:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< I am able to get the various events to trigger on key down / press / up
BUT only if:

a) I have at least one "focusable" control on the form
b) A "focusable" control has "focus"

I have a form with no focusable controls, merely some TPanlels and TImages
but want to perform certain actions when the up / down arrows are pressed.

Can this be achieved? >>

Unfortunately, no, not at this time.  The key preview for forms/panels only
works if there's an actual control that can accept keyboard input on the
form/panel.

I'll have to do some experimenting to see if there's an easy workaround or
not (such as just enabling the tab index for the panel).

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 9 2012 2:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

I was able to add this, so it's now in there - panels and forms get
keystrokes if no other controls are present that can accept keystrokes, and
only get keystrokes if KeyPreview=True when there are controls that *can*
accept keystrokes.  It was surprisingly easy, which worries me.... Wink

BTW, I also made sure that the OnKey* events were added for the TPanel
component at design-time.  For some reason, they were not present.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Aug 14 2012 9:41 AMPermanent Link

Mark Brooks

Slikware

Avatar

<<I was able to add this, so it's now in there - panels and forms get
keystrokes if no other controls are present that can accept keystrokes, and
only get keystrokes if KeyPreview=True when there are controls that *can*
accept keystrokes.  It was surprisingly easy, which worries me.... Wink

BTW, I also made sure that the OnKey* events were added for the TPanel
component at design-time.  For some reason, they were not present.>>

Fantastic Tim
Many thanks
Is there a new download imminent?
Mark
Image