Re: Can't manage ... it's a top-level window
- From: Robert Heller <heller@xxxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 21:13:54 +0100
At Fri, 30 Nov 2007 11:59:11 -0800 (PST) vnpenguin <vnpenguin@xxxxxxxxx> wrote:
Hi all,
I'm newbie to Tcl/Tk. Just install ActiveTcl8.4.16.0.282109 on my
Win2k box. I'm try now the follow code:
=========================================
set FR0 [ labelframe .fr0 -text "Test" ];
set lb1 [ label $FR0.name1 -text "Name:" ];
set op_menu1 [ tk_optionMenu $FR0.op1 v_op1 "A" "B" "C" ];
set lb2 [ label $FR0.name2 -text "Name2::" ];
set op_menu2 [ tk_optionMenu $FR0.op2 v_op2 "X" "Y" "Z" ];
grid $lb1 $op_menu1 -row 1
grid $lb2 $op_menu2 -row 2
pack $FR0
=========================================
But when I run I got error:
Can't manage ".fr0.op1.menu": it's a top-level window
while executing
"grid $lb1 $op_menu1 -row 1"
(file "test01.tcl" line 8)
Anyone could tell me how to fix that please,
tk_optionMenu does NOT return the menubutton widget ($FR0.op1 /
$FR0.op2), but instead it returns the popup menu associated with the
menubutton widget. Bascially, you really cannot use the result of
tk_optionMenu the way you can use the result of normal widget creation
functions.
Try this code instead (which works with Tcl/Tk 8.4.7 under CentOS 4.5):
=========================================
set FR0 [ labelframe .fr0 -text "Test" ];
set lb1 [ label $FR0.name1 -text "Name:" ];
set op_menubut1 $FR0.op1
set op_menu1 [ tk_optionMenu $op_menubut1 v_op1 "A" "B" "C" ];
set lb2 [ label $FR0.name2 -text "Name2::" ];
set op_menubut2 $FR0.op2
set op_menu2 [ tk_optionMenu $op_menubut2 v_op2 "X" "Y" "Z" ];
grid $lb1 $op_menubut1 -row 1
grid $lb2 $op_menubut2 -row 2
pack $FR0
=========================================
Thanks in advance,
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk
.
- Follow-Ups:
- Re: Can't manage ... it's a top-level window
- From: vnpenguin
- Re: Can't manage ... it's a top-level window
- References:
- Can't manage ... it's a top-level window
- From: vnpenguin
- Can't manage ... it's a top-level window
- Prev by Date: Can't manage ... it's a top-level window
- Next by Date: Re: Can't manage ... it's a top-level window
- Previous by thread: Can't manage ... it's a top-level window
- Next by thread: Re: Can't manage ... it's a top-level window
- Index(es):