2

I've got this as my code

 openAll = File.open('N:\Josh\Blondie\db.txt')
 allNumbers = Array.new
 allNumbers=[]  
  openAll.each_line {|line|
    allNumbers.push line
  }

  puts allNumbers

and I'd like to be able to display the output of this code in a new window with Ruby Shoes, I can't seem to get it to display anything though. The contents of the file are names and phone numbers.

Any ideas?

Josh
  • 175
  • 10
  • Maybe you should put some code here that tells us what you've tried, in addition to code that shows us you have data in an array. – Ryanmt Sep 02 '11 at 15:39

2 Answers2

2

Here's an example of outputting text to a shoes window. Using a puts statement just outputs to the shell, not to the Shoes app.

Shoes.app :title => "GUI RAW file converter, for the CLI challenged", 
  :resizable => true do 
  background white 
  stack do 
    flow {
      background gray, :height => 30
      caption "Caption", :margin => 8, :stroke => white
      stack {
        para 'This is a fancy line I just printed to the window'
####### Here's an example line you could use to put out the array...
        allNumbers.each do |number|
          para "#{number}"
        end
      }
    }
  end
end
Ryanmt
  • 3,215
  • 3
  • 22
  • 23
0

I guess you should use the method Kernel#alert instead of Kernel#puts.

http://shoesrb.com/manual/Built-in.html

Pedro Rolo
  • 28,273
  • 12
  • 60
  • 94
  • While `alert` will get shoes to actually do something, as compared to the `puts` statement from the OP, the alert will cause an Alert, or a pop up alert box, not content in a shoes window. – Ryanmt Sep 03 '11 at 14:26