PC Review


Reply
Thread Tools Rate Thread

break windows execution on key press event

 
 
andrew
Guest
Posts: n/a
 
      9th Dec 2003
I am trying to allow a windows form to accept an escape
character to cancel the current operation (drawing a line
on panel control contained within the form).
I thought that the forms KeyPress or KeyDown event would
suffice, but I have tried them and they don't seem to work.

My form has a treeview docked to the LHS side, with a
splitter control and then a panel filling the RHS.

I have tried various combinations and find that the key
pressed event doesn't seem to fire when my form has a
treeview control on it (i.e I tried various combinations
of blank form, form with one panel det to fill, form with
two panels docked and splitters etc and I was able to
display a message informing me of the key pressed event.

Is this a glitch and does anyone have ideas on how to
overcome?

Thanking a helpful soul in advance.

Andrew
 
Reply With Quote
 
 
 
 
EricJ
Guest
Posts: n/a
 
      9th Dec 2003
did you set the form keyprieview event to true?


"andrew" <(E-Mail Removed)> wrote in message
news:005201c3be06$1208e580$(E-Mail Removed)...
> I am trying to allow a windows form to accept an escape
> character to cancel the current operation (drawing a line
> on panel control contained within the form).
> I thought that the forms KeyPress or KeyDown event would
> suffice, but I have tried them and they don't seem to work.
>
> My form has a treeview docked to the LHS side, with a
> splitter control and then a panel filling the RHS.
>
> I have tried various combinations and find that the key
> pressed event doesn't seem to fire when my form has a
> treeview control on it (i.e I tried various combinations
> of blank form, form with one panel det to fill, form with
> two panels docked and splitters etc and I was able to
> display a message informing me of the key pressed event.
>
> Is this a glitch and does anyone have ideas on how to
> overcome?
>
> Thanking a helpful soul in advance.
>
> Andrew



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      9th Dec 2003
* "andrew" <(E-Mail Removed)> scripsit:
> I am trying to allow a windows form to accept an escape
> character to cancel the current operation (drawing a line
> on panel control contained within the form).
> I thought that the forms KeyPress or KeyDown event would
> suffice, but I have tried them and they don't seem to work.
>
> My form has a treeview docked to the LHS side, with a
> splitter control and then a panel filling the RHS.
>
> I have tried various combinations and find that the key
> pressed event doesn't seem to fire when my form has a
> treeview control on it (i.e I tried various combinations
> of blank form, form with one panel det to fill, form with
> two panels docked and splitters etc and I was able to
> display a message informing me of the key pressed event.


You can add a button and define it as the form's 'CancelButton'. Or
you can set the form's 'KeyPreview' property to 'True' and wait for Esc
in the form's 'KeyDown' event handler.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Patches perhaps break Windows Scheduled Task execution? =?Utf-8?B?SmFtZXMgTGFuZ2U=?= Microsoft Windows 2000 Security 0 24th Oct 2007 03:03 PM
Cannot break execution properly Antonio via AccessMonster.com Microsoft Access VBA Modules 2 22nd Dec 2005 03:12 PM
Formatting Page, press CTRL+Break to stop =?Utf-8?B?U0hJUFA=?= Microsoft Access Reports 2 28th Apr 2005 07:58 PM
Break execution running from a form =?Utf-8?B?U2hlcnls?= Microsoft Access Form Coding 0 28th Dec 2004 06:49 PM
Break the code execution Warrio Microsoft Excel Programming 2 12th Mar 2004 10:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:08 PM.