001 require 'phi' 002 form = Phi::Form.new(:form1, 'formです') 003 button = Phi::Button.new(form, :button1, 'hoge') 004 button.on_click = proc do 005 t = Time.now.to_s 006 print t, "\r\n" 007 button.caption = t 008 end 009 form.show 010 Phi.mainloop
001 require 'phi' 002 003 form = Phi::Form.new(:form1, 'formです') 004 button = Phi::SpeedButton.new(form, :button1, 'hoge') 005 button.flat = true 006 button.allow_all_up = true 007 button.group_index = 1 008 button.on_click = proc do 009 if button.down? 010 button.caption = '1' 011 else 012 button.caption = '2' 013 end 014 end 015 form.show 016 Phi.mainloop
001 require 'phi' 002 003 form = Phi::Form.new(:form1, 'formです') 004 button = Phi::RadioButton.new(form, :button1, 'hoge') 005 form.on_click = proc do 006 if button.checked? 007 print "checked\r\n" 008 else 009 print "not checked\r\n" 010 end 011 end 012 form.show 013 Phi.mainloop