0

After quite some headache, I realized that the Shoes.app call blocks the execution of further code. I tried wrapping it in Thread.new but then the window doesn't get displayed. How can I launch a window and manipulate it from the outside?

require 'shoes'

app = Shoes.app do
  para "I block the execution."
  button "I've seen enough" do
     exit
  end
end

print("Called when the window terminates")

I originally thought the problem was me incorrectly saving and handling app or it's variables inside the block, since there is a special line about it in the manual (http://shoesrb.com/manual/Rules.html on Block Redirection) and what I did outside of the block didn't change the window. In my opinion, the manual is not very clear on blocking.

magmabyte
  • 397
  • 1
  • 2
  • 10
  • 1
    Just them through the eyelets and make a bow... _har har har_ – Charlie G Mar 27 '17 at 21:56
  • ...Why not wrap your other code in a thread? Generally, the GUI thread is the main one, anyway, because you normally want everything else to stop when the GUI is closed (_closed_, not _hidden_). Otherwise, your users are going to be surprised that your app is still running in the background when they could have sworn they closed it. – Nic Mar 29 '17 at 05:12

0 Answers0