Article View: borland.public.cppbuilder.nativeapi
Article #9169Re: Windows spacebar hotkey
From: Andrue Cope [TeamB]
Date: Thu, 29 Jul 2004 13:37
Date: Thu, 29 Jul 2004 13:37
43 lines
2794 bytes
2794 bytes
Chris Croughton wrote: > I don't want a dialog box, and I don't want anything to grab either > space or the cursor keys. Think of a terminal emulator, for instance, > where the cursor keys need to send the appropriate codes to the other > end. The important point is that only the component with the current focus gets sent the [space] keypress and only it gets a chance to respond to it. > So the answer is to always move the focus to something else which > doesn't have that action but does have an OnKeyPress event, yes? Yes. > What would be suggested as a control which can receive do that? When I wrote my editor (which was a couple of years ago now) I put a TEdit on the form and hid it under a panel. Its Visible property has to be True so that it can receive focus but you don't want the component visible to the user so cover it up :) I don't know that a TEdit is the best component - I just picked that. Probably you just want whatever component consumes the least resources but has OnEnter/OnExit and possibly OnKeyPress/OnKeyDown events. I say possibly for the key events because all I have defined for the TEdit are OnEntry and OnExit which take care of drawing a focus rectangle around the edit window and setting a flag. My form responds to OnKeyPress and OnKeyDown on behalf of the editor and has Keypreview set to true. I'm not sure why I did this now but I do remember that it was a solution to something. TBH my knowledge of the VCL is based around "getting it working" rather than "coding it the right way" :) Whatever the merits of this strategy it is pretty simple and has worked for me for a couple of years now :) -- Andrue Cope [TeamB] [Bicester, Uk] http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<4108fd87$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4107b926$1@newsgroups.borland.com> <4107c851@newsgroups.borland.com> <slrncgg2ei.f6p.chris@ccserver.keris.net> <4108b254$1@newsgroups.borland.com> <slrncghsd7.7ug.chris@ccserver.keris.net>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,af0a7a309a9df709 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Andrue Cope [TeamB]" <no.spam@spammy.com> Subject: Re: Windows spacebar hotkey Newsgroups: borland.public.cppbuilder.nativeapi References: <4107b926$1@newsgroups.borland.com> <4107c851@newsgroups.borland.com> <slrncgg2ei.f6p.chris@ccserver.keris.net> <4108b254$1@newsgroups.borland.com> <slrncghsd7.7ug.chris@ccserver.keris.net> User-Agent: XanaNews/1.16.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 NNTP-Posting-Host: 217.207.223.34 Message-ID: <4108fd87$1@newsgroups.borland.com> Date: 29 Jul 2004 06:37:11 -0700 X-Trace: newsgroups.borland.com 1091108231 217.207.223.34 (29 Jul 2004 06:37:11 -0700) Lines: 43 X-Authenticated-User: acope Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail