RubyTk variable problem

As a RubyTk newbee, I am trying to solve this:

I have loaded some fonts into $list, and put it
into a listbox, works fine.

Then I want to load a selection from the listbox into the variable
$font, but cant get it working.

This code works fine, printing out to console:
$list.curselection.each {|i| p $list.get(i)}

This code gives no errors, but $font remains empty:
$list.curselection.each {|i| $font = $list.get(i)}

And if i do:
$list.curselection.each {|i| $font = p $list.get(i)}
it prints out to console, but $font remains empty.

How do i load the value of $list.get(i) into $font ?


There was a bug elsewhere in my code, trying to use the variable
before it was given a value :frowning:



Den Fri, 09 Jan 2004 10:52:37 +0100. skrev Svend-Erik Madsen: