Am Donnerstag, den 31.01.2008, 08:39 +0200 schrieb A.J. Venter: > > I haven't looked into the sources deeply, but can't you override some > > OnKeyXxx-methods to get the key events? > I don't think there ARE any to overwrite- perhaps in the parent class > for TCustomControl, but they aren't republished. If you use override > though - you may as well rewrite them as you'll need to do the same work > anyway - it doesn't solve the clutter-and-duplicate problem.
Seems to be that way, I couldn't find them either (but I didn't search for hours or try to understand how it may work ;). > > 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. TForm only get's the events from the keyboard if "KeyPreview" is set, IIRC. Apparently it's not a good way to go because enforcing key preview on the form may spoil some other techniques or hinder existing programs from working. I hope someone having intimate LCL knowledge can jump in here and suggest a less intrusive approach... Marc _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives