Manfred <
man...@antispam.com> wrote:
> Hi
> I have a small script:
> ##script start
> set ::y 8
> set ::x 5
> proc tuwas {args} {set ::x $::y}
> trace add variable ::x read "tuwas"
> pack [label .en -textvariable ::x]
> puts "X1 :: $x"
> ##label show "8", commandline show "X1 :: 8" like expected
Upon creation, the label once reads out the current value of its
variable and that turns out 8 due to the read-trace. So far so good.
> set ::y 45
> set ::x
>
> ##label show "8", I expected 45. commandline show "X2:: 45", like expected.
After that, it'll register it's own write-trace on its variable x,
and this trace doesn't get fired, if the assignment happens from
within another trace namely from the read-trace triggered from "set x".
> after 5000 "set ::x $::y"
> ##label show "45", like expected.
Here, the assignment to x happens outside any trace-handler, and thus
seen by the label.