Re: tk widget
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: tk widget

From: Bryan Oakley <oakley@bardo.clearlight.com>
Date: Sat Mar 04 2006 - 14:15:42 CET

Donald Arseneau wrote:
> proc create_form {frame ident} {
> set arr "[string trim $ident]values"
> set txtid [string trim $ident]
> if { [string length $txtid] } {
> append txtid " "
> }
> frame $frame
> label $frame.label1 -text "${txtid}MB_SER" ...
> entry $frame.entry1 -textvariable $arr(MB_SER) ...

You're making too much work for yourself. Just use a single array for
the textvariables, and another one for the labels:

     label $frame.label1 -text $text($ident,MB_SER) ...
     entry $frame.entry1 -textvariable $data($ident,MB_SER)

Rarely, if ever, does it make sense to use dynamically created variable
names; it just makes the code harder to read.

--
Bryan Oakley
http://www.tclscripting.com
Received on Sun Apr 30 02:23:27 2006