RubyTk variable problem

  • Thread starter Svend-Erik Madsen
  • Start date
S

Svend-Erik Madsen

Hi
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 ?



/Svend-Erik
 
S

Svend-Erik Madsen

Den Fri, 09 Jan 2004 10:52:37 +0100. skrev Svend-Erik Madsen:
There was a bug elsewhere in my code, trying to use the variable
before it was given a value :-(

sorry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top