Article View: borland.public.cppbuilder.nativeapi
Article #16136Re: Virtual Key problem
From: Eudy Silva
Date: Wed, 28 May 2003 16:11
Date: Wed, 28 May 2003 16:11
67 lines
3534 bytes
3534 bytes
Test1: Create a new GUI app with a form and 4 buttons on it and code your formkeydown event handler (don't forget KeyPreview = true). You'll see that the FormKeyDown event is never fired for the arrow keys, ENTER or TAB (but it is fired for ESC or SPACE, for instance). You might even code a ButtonKeyDown event it will have the same behavior. Test2: Now drop a memo on the form above and you'll see the key event is fired when the memo has focus (note the TAB key won't fire the event either). If you set the memo's WantTabs to true then the TAB key fires the form's keydown event. You see, the behavior depends on what control has the focus on your form. My understanding is that the OS sends a WM_GETDLGCODE directly to the *focused* control (bypassing the form) and the TAB or arrow key events will be sent to the control depending on its response. If the the control responds to WM_GETDLGCODE with DLGC_WANTARROWS or DLGC_WANTTAB or a combination, then such events will be send to the control and the form wll be able to intercept them. Otherwise not. That's why you need to work at the control level. What I don't know is the mechanism by which the focus changes on a form, by pressing the arrow keys, from a button to another, for instance. Who gets this message? Hope someone else can explain this better. Eudy Nicholas Gessler wrote: > At this point I am more confused than ever. The applications I have written > in which the ArrowKeys WORK are virtually identical to those in which the > ArrowKeys DO NOT WORK. The Form1 Properties and Events are identical as are > the includes and Unit1.h files. > > So I don't understand why one WORKS and one DOES NOT. > Also, FAQ-78 says NOT to create a handler for my Form1. But that's > precisely where I want the ArrowKeys to register. > > I am sure I must be missing something quite obvious to others on this > newsgroup, but I just can't figure it out. > What is going on? And how can I make it right? > > Thanks, > Nick > > "Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message > news:3ed1839d$1@newsgroups.borland.com... > >>The arrow keys do not produce OnKey... events by default. You must >>explicitally request them before Windows will then issue them as expected. >> >> Receive key events for the arrow keys or the TAB key >> http://www.bcbdev.com/faqs/faq78.htm >> >>Gambit > > >
Technical Details
Message-ID:
<3ED4DFC2.3060603@directnet.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ed17b8f@newsgroups.borland.com> <3ed1839d$1@newsgroups.borland.com> <3ed2e51d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,b34f1e4dec3a67c2 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-28 09:44:07 PST Message-ID: <3ED4DFC2.3060603@directnet.com> Date: Wed, 28 May 2003 13:11:46 -0300 From: Eudy Silva <eudy@directnet.com> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Virtual Key problem References: <3ed17b8f@newsgroups.borland.com> <3ed1839d$1@newsgroups.borland.com> <3ed2e51d@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 200.152.8.215 X-Trace: newsgroups.borland.com 1054138186 200.152.8.215 (28 May 2003 09:09:46 -0700) Lines: 68 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail