Am Donnerstag, 31. Januar 2008 07:39 schrieb A.J. Venter:
[...]
> > If not, maybe hooking into the surrounding forms events would
> > suffice.
>
> This was my first idea, but unfortunately, it doesn't work at all.
> The reason is that forms only get keyboard focus onActivate and even
> then they only keep it if there is no focusable components - else
> it's hardpassed to the component with focus preference. Running
> Form.SetFocus throws an exception (Form cannot take focus) - [why is
> it there if it cannot be called ?]
> If there is a way to make a form take keyboard focus to itself so
> it's keyEvents work even if there are focusable components on it then
> I haven't found it yet.
Isn't TForm.KeyPreview meant for exactly this purpose? Just set it to
true and your form should get the KeyEvents regardless of which
component has the focus .. off course this still only works if the form
is active ..
regards
Burkhard
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives