I think it has to do with the ".". Seems tcl interprets
the dot as the end of the variable, unless it follows
the dollar sign (but I'm not sure about this).
If you are in the global namespace, you can write
if {$.top1::rad1 == 1} {...}
because by defaut everything is relative to "::" so
$.top1::rad1
is equivalent to
${::.top1::rad1}
Or, if you only use the toplevel namespace you can
write (but this is a bit longer):
namespace eval .top1 {
variable rad1
if {$rad1 == 1} {
...
}
}
CG
|--------+------------------------------------->
| | Stef Pillaert |
| | <[EMAIL PROTECTED]> |
| | Sent by: |
| | [EMAIL PROTECTED]|
| | eforge.net |
| | |
| | |
| | 06/12/2001 11:36 PM |
| | Please respond to vtcl-user|
| | |
|--------+------------------------------------->
>-----------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
| Fax to:
|
| Subject: [vtcl-user] using namespace variables
|
|
|
>-----------------------------------------------------------------------------------------------------------|
Hello list,
I'm trying to get used to namespaces (a good idea to use them automatically
when inserting an input widget: this made me see the benefit of it! The
only
disadvantage is the length of all the var-names...).
When I insert a checkbutton in a toplevel, it gets a variable (e.g.
.top1::rad1)
When I use this variable in the command associated with the checkbutton, I
have to write something like:
if {${::.top1::rad1} == 1} {.....}
where the following doesn't work:
if {$::.top1::rad1 == 1} {.....}
I assume this has something to do with tcl-substitution-rules, but I don't
see it. Can someone explain to me why only the first version works (I'm
still
learning ....:-)
Thanks,
Stef.
==============================================================
Stef Pillaert
Brusselse steenweg
B9090 Melle (Belgium-Europe)
Phone: (00) 32 / (0) 9 / 252 20 51
E-mail: [EMAIL PROTECTED]
_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/vtcl-user
_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/vtcl-user