Re: Substitution error?
- From: Bryan Oakley <oakley@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 May 2005 16:08:04 GMT
Eduardo Peña wrote:
Hi,
I have a top frame followed by a loop:
******************************************* set topf [frame $frame.topf] for {set i 0} {$i < 10} {incr i} { set a$i [TitleFrame $topf.a$i -text "Title $i"] pack $a$i } *******************************************
But i have an error: can´t read "a": no such variable while executing pack $a$i
My questions are: How i can pack this frames/titleframes in a loop "n" times? What happend with a for-loop in local use of variables in frames/subframes?
pack [set a$i]
If you use arrays it becomes easier:
set a($i) [TitleFrame...]
pack $a($i)Useful Rule O' Thumb: avoid dynamic variable names unless you're certain you absolutely need them.
.
- References:
- Substitution error?
- From: Eduardo Peņa
- Substitution error?
- Prev by Date: Re: Problems with autoexpect
- Next by Date: Re: TclXSLT question: best approach?
- Previous by thread: Substitution error?
- Next by thread: Re: Substitution error?
- Index(es):
Relevant Pages
|