BUG: Errors and menu commands 
Author Message
 BUG: Errors and menu commands

Here's a funny in the final release Tcl/Tk 8.0 running under windows95.
Normally if an error occurs in a Tk event handler it produces a dialog
box and possibly a stack trace. e.g., if you go

% button .b -command {expr 1/0}
% pack .b

and click the button, you get a dialogue box with "error: divide by

However if the error happens when handling a menu selection, this
doesn't happen. If you do

% menubutton .mb -menu .mb.menu -text "crash menu"
% set m [menu .mb.menu]
% $m add command -label "crash 1" -command {expr 1/0}
% pack .mb

then choose the menu item, no error indication is produced.

Oddly enough if you catch the error then throw it again, you can get the
error box, for instance continue the above with

% $m add command -label "crash 2" -command {if [catch {expr 1/0} err]
{bgerror $err}}

now select the second item from the menu, and it will produce the error
box although the actual menu event will not appear in the stack trace.

Is this something to do with another change in 8.0, i.e., that the
pulldown menu is now tidied away immediately rather than staying out
until the command has been completed?


Mon, 20 Mar 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Q:foreach/menu add command quirk/bug

2. pulldown menus and cascade commands (Was TK bug?)

3. Bug in menu widget index command

4. Un-trapped errors from Menu commands on Win95 at Tk8.0p2

5. PopupMenu bug, menu bug, apple bug (worm)?

6. Tk8.1a1 BUG+PATCH: configuration, GIF_COLOR, menu errors.

7. BUG: relief handling in menus during error situations

8. Tkinter menu commands activate when menu is built

9. bug in 8.2/windows menu item delete in middle of menu

10. Tk81a1 Win32 Menu Bugs: System menu; Booleans

11. Bug: WinTk crashing menu bug

12. Problem with exec command: error reading output from command: interrupted


Powered by phpBB® Forum Software