Joe Van Dyk
7/14/2005 10:44:00 PM
On 7/14/05, David Douthitt <ssrat@mailbag.com> wrote:
> I think I'm getting closer (at least) to understanding this. Instead
> of:
>
> $serverVariable["server"] = 1
>
> ....what I want is, in reality:
>
> lvalue_of_what_is_pointed_to_by($serverVariable["server"]) = 1
You mean,
$serverVariable["server"].value = 1
?
>
> ....that is, this $serverVariable["server"] contains a TkVariable, and
> after the assignment it contains a 1 instead. I want to set not the
> array value, but the contents of the array value. A reference, if you
> will.
>
> But how? I'm still trying...
Maybe this will help?
require 'tk'
$root = TkRoot.new
$var = TkVariable.new
$button = TkCheckButton.new $root, :variable => $var, :text => "Hello World"
$button.pack
# alternates the value of $var from one to zero every second.
TkTimer.start 1000, -1, proc { $var.value = $var.value == "0" ? 1 : 0 }
Tk.mainloop