🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9085

Re: Windows spacebar hotkey

#9085
From: Chris Croughton
Date: Fri, 30 Jul 2004 13:53
66 lines
3464 bytes
On 29 Jul 2004 06:37:11 -0700, Andrue Cope [TeamB] 
   <no.spam@spammy.com> wrote:

> 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.

Ah, I see.  So in this case it's the button which decides[1] that a
space will mean "click" and a tab means "go to the next button" or
whatever.  If the current focus is on an edit field, that interprets it.

[1] Simplification: it's actually the thing interpreting the component
and form data.

(Spot the person who doesn't normally program GUI at all <g>.  In fact I
normally regard a GUI or window manager only as a way to run 36 or more
xterms with the same physical screen, and occasionally copy and paste
between them...)

> 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 :)

Presumably the TEdit was the same size as the panel?

> 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.

Right.

> 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.

OK.

> 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" :)

The form responds to OnKeyPress?  How do you set it to do that?

Yup, "getting it working" is what I need.

> Whatever the merits of this strategy it is pretty simple and has worked
> for me for a couple of years now :)

The superstition paradigm: it worked when I did it that way once, so
I'll always do it that way <g>.  In a world which is too complex to
understand the details of everything, superstition is often the most
efficient way to do anything...

Thanks,

Chris C
Technical Details
Message-ID: <slrncgkkn7.9lp.chris@ccserver.keris.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail
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> <4108fd87$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,af0a7a309a9df709
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail
From: Chris Croughton <chris@keristor.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Windows spacebar hotkey
Date: Fri, 30 Jul 2004 14:53:43 +0100
Lines: 66
Message-ID: <slrncgkkn7.9lp.chris@ccserver.keris.net>
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> <4108fd87$1@newsgroups.borland.com>
Reply-To: chris@keristor.net
X-Trace: news.uni-berlin.de 5UUR9Cjqr86QWkPq/f7oKwdSXX/mYDXkryBwxHZy9ov+wH4JY=
X-Orig-Path: ccserver.keris.net!news
User-Agent: slrn/0.9.7.4 (Linux)