Article View: borland.public.cppbuilder.nativeapi
Article #16229Re: Virtual Key problem
From: Dumboo
Date: Wed, 28 May 2003 07:37
Date: Wed, 28 May 2003 07:37
36 lines
2165 bytes
2165 bytes
Arent you missing Someting maybe {}, (maybe not) anyway
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
Form1->Color = clRed;
if (Key == VK_LEFT) {Form1->Color = clWhite; direction = 3;}
if (Key == VK_RIGHT) {Form1->Color = clBlue; direction = 1;}
if (Key == VK_UP) {Form1->Color = clGreen; direction = 0;}
if (Key == VK_DOWN) {Form1->Color = clYellow; direction = 2;}
}
-Dumboo
"Nicholas Gessler" <gessler@ucla.edu> wrote in message
news:3ed17b8f@newsgroups.borland.com...
> I am puzzled...
> I have used KeyDown VK code in other applications and they all work:
>
> void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
> TShiftState Shift)
> {
> Form1->Color = clRed;
> if (Key == VK_LEFT) Form1->Color = clWhite; direction = 3;
> if (Key == VK_RIGHT) Form1->Color = clBlue; direction = 1;
> if (Key == VK_UP) Form1->Color = clGreen; direction = 0;
> if (Key == VK_DOWN) Form1->Color = clYellow; direction = 2;
> }
>
> But now, for some reason that escapes me, KeyDown is detected (since the
> form turns Red), but the arrow keys just don't do anything... I am
stumped!
>
> Nick
>
>
Technical Details
Message-ID:
<3ed46271@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ed17b8f@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 01:05:13 PST From: "Dumboo" <dumboo@nowhere.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ed17b8f@newsgroups.borland.com> Subject: Re: Virtual Key problem Date: Wed, 28 May 2003 13:07:59 +0530 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 203.124.231.111 Message-ID: <3ed46271@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054106225 203.124.231.111 (28 May 2003 00:17:05 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail