#!ruby -Ks
require "phi"

form = Phi::Form.new
btn = Phi::Button.new form, :btn , "click to new thread ??"
btn.align = Phi::AL_CLIENT
threads = []
btn.on_click = proc{
  thread = Phi::Thread.new{
    no = threads.size
    label=Phi::Label.new form
    label.align = AL_TOP
    cnt = 0 unless cnt
    while true
      cnt += 1
      label.caption = "no.#{no} "+cnt.to_s
      Phi::APPLICATION.process_messages
    end
  }
  threads.push thread
}

form.show
Phi.mainloop
raise
