
container frame w/toplevel problems (win98)
I want to embed a toplevel with a menubar within a frame (actually,
a frame of a tabbed notebook widget). Here is some code to test this
concept. It works as expected on Unix (8.4.4), but fails on Win98
(ActiveState's 8.4.6).
The code:
proc aMenubar {w n} {
menu $w -type menubar
$w add cascade -label "File" -menu [menu $w.file -tearoff false]
$w.file add command -label "Open" -command [list puts "Open $n"]
$w.file add command -label "Exit" -command {exit}
$w add cascade -label "Execute" -menu [menu $w.execute -tearoff false]
$w.execute add command -label "Run" -command [list puts "Run $n"]
$w.execute add command -label "Reset" -command [list puts "Reset $n"]
return $w
}
# Containers
frame .f1 -container true
frame .f2 -container true
pack .f1 .f2 -side left
# ONE: embedded, use pack on the menubar
toplevel .t1 -use [winfo id .f1]
.t1 configure -menu [aMenubar .t1.m one]
label .t1.l -text ONE -width 50
pack .t1.m .t1.l -side top
# TWO: embedded, don't do anything with the menubar
toplevel .t2 -use [winfo id .f2]
.t2 configure -menu [aMenubar .t2.m two]
label .t2.l -text TWO -width 50
pack .t2.l -side top
# THREE: non-embedded toplevel
toplevel .t3
.t3 configure -menu [aMenubar .t3.m three]
label .t3.l -text THREE -width 50
pack .t3.l -side top
The problem on Win98 is that the menubar for the toplevel is
not shown on the embedded toplevel's. If I create a non-embedded
toplevel, the menubar works as expected.
I tried using "pack" on the menu (example ONE). That results in
the menu being displayed -- but not as a menubar. When I do not
pack the menu (example TWO), then the menubar does not show up.
The same toplevel (but not embedded, example THREE) works as
expected.
Is this a windows limitation or a bug? Or is there something I'm
not doing correctly? Any help would be appreciated.
-----
In addition, on Win98 I must be exposing a bug in wish. When I select the
"exit" menu item I get a popup:
+----------------------------------------+
| Fatal Error in Wish |
| TkpGetOtherWindow couldn't find window |
+----------------------------------------+
which is followed by another popup:
+------------------------------------------------+
| The program has performed an illegal operation |
| and will be shut down. |
| If the problem persists, contact the program |
| vendor |
| Details>> |
+------------------------------------------------+
WISH caused an exception 03H in module KERNEL32.DLL at 0187:bff768a1.
Registers:
EAX=00000001 CS=0187 EIP=bff768a1 EFLGS=00000286
EBX=0073fa04 SS=018f ESP=0073eacc EBP=0073eed8
ECX=80005188 DS=018f ESI=00008a28 FS=796f
EDX=8000a8f0 ES=018f EDI=0073f9b8 GS=0000
Bytes at CS:EIP:
c3 cc cc 55 8b ec 56 57 68 c0 94 fc bf e8 01 d9
Stack dump:
004011d4 0073eee4 004d189c 47706b54 744f7465 57726568
6f646e69 6f632077 6e646c75 66207427 20646e69 646e6977
bf00776f 00000187 bff741e9 00019b04