From: Batox on 23 Jul 2010 08:04 I know it's basic TCL, and I feel stupid for not knowing the solution myself, but well... it's nearly 10 years I last worked with TCL/TK :) I want to split a list so that it behaves exactly like literals. My problem occurs while working with row attributes in a tablelist (.t is the tablelist): % .t rowattrib k0 Foo Bar % .t rowattrib k0 {Foo Bar} % .t unsetrowattrib k0 Foo % .t rowattrib k0 % set s "Foo Bar" Foo Bar % .t rowattrib k0 $s % .t rowattrib k0 I need to use a variable in the place of the literals - [split $s " "] doesn't do the job either.
From: Alexandre Ferrieux on 23 Jul 2010 08:14 On Jul 23, 2:04 pm, Batox <ba...(a)ebruenner.de> wrote: > I know it's basic TCL, and I feel stupid for not knowing the solution > myself, but well... it's nearly 10 years I last worked with TCL/TK :) > > I want to split a list so that it behaves exactly like literals. My > problem occurs while working with row attributes in a tablelist (.t is > the tablelist): > > % .t rowattrib k0 Foo Bar > % .t rowattrib k0 > {Foo Bar} > % .t unsetrowattrib k0 Foo > % .t rowattrib k0 > % set s "Foo Bar" > Foo Bar > % .t rowattrib k0 $s > % .t rowattrib k0 > > I need to use a variable in the place of the literals - [split $s " "] > doesn't do the job either. Pre-8.5: eval .t rowattrib k0 $s 8.5+, also: .t rowattrib k0 {*}$s -Alex
From: Batox on 23 Jul 2010 11:39 I had been experimenting with eval but the wrong way. The 8.5+ way is more elegant :) Thanks a lot!
|
Pages: 1 Prev: upvar bad level error Next: how to operate on in memory hashes or arrays |