$A = new Win32::GUI::AcceleratorTable(
"Esc" => "Esc");
$M = new Win32::GUI::Menu(
"&File" => "File",
" > E&xit" => "Exit");
$W = new Win32::GUI::Window (
-title => "Some Title",
-menu => $M,
-accel => $A,
-name => "Window",
-left => 125,
-top => 25,
-width => 550,
-height => 580);
sub Esc_Click {
my $question = "Do you wish to Exit the Program?";
my $ans = Win32::GUI::MessageBox($W,$question,"Some Title",36,);
#-- 6=yes, 7=no
if ($ans == 7) {return;}
return -1; #-- stops event handler
}
-----Original Message-----
From: Eric Hansen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 4:26 PM
To: '[email protected]'
Subject: ESC Key, How to stop program termination?
My Win32::GUI program terminates when the ESC key is pressed.
I only want my users to be able to mouse click File->Exit, or
The X in the upper right corner of the window/dialogbox to end
The program. How can the ESC key be trapped? Thanks, -Eric
Exit_Click {
return -1;
}
Window_Terminate {
return -1;
}