🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Cancelling Esc key being pressed

#3073
From: Remy Lebeau (TeamB)
Date: Mon, 25 Sep 2006 17:32
33 lines
1870 bytes
"Russell Allen" <russell.allen@bt.com> wrote in message
news:4517e850$1@newsgroups.borland.com...

> The problem I'm having - when a piece of code elsewhere pops up
> a dialog box with a Cancel option, if the user presses "Esc" to cancel
> the dialog box, not only is the dialog box cancelled, the onkeyup event
> is being fired off as well!

    void __fastcall TForm1::FormKeyUp(TObject *Sender, char &Key)
    {
        if( Key == VK_ESCAPE )
            Key = 0;
    }


> Can I include a line to stop the Esc key press firing other events

No.

> can I maybe unhook the OnKeyUp event handler before the dialog
> and rehook it after the dialog box?

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
        this->OnKeyUp = NULL;
        MessageDlg("Proceed?", mtConfirmation, TMsgDlgButtons() << mbYes <<
mbCancel, 0);
        this->OnKeyUp = FormKeyUp;
    }


Gambit
Technical Details
Message-ID: <45181312$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!colt.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4517e850$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,31de055eac3be198
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4517e850$1@newsgroups.borland.com>
Subject: Re: Cancelling Esc key being pressed
Date: Mon, 25 Sep 2006 10:32:03 -0700
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 69.169.4.232
Message-ID: <45181312$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1159205650 69.169.4.232 (25 Sep 2006 10:34:10 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.icl.net!colt.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail