001 require 'phi' 002 003 form = Phi::Form.new(:form1, 'formです') 004 edit = Phi::Edit.new(form, :edit1) 005 button = Phi::Button.new(form, :button1, 'OK') 006 007 form.width = 350 008 form.height = 50 009 edit.align = Phi::AL_CLIENT 010 edit.text = '' 011 button.align = Phi::AL_RIGHT 012 013 button.on_click = proc do 014 print edit.text, "\r\n" 015 end 016 017 form.show 018 Phi.mainloop
001 require 'phi' 002 003 form = Phi::Form.new(:form1, 'formです') 004 combobox = Phi::ComboBox.new(form, :combobox1) 005 button = Phi::Button.new(form, :button1, 'OK') 006 007 form.width = 350 008 form.height = 50 009 combobox.align = Phi::AL_CLIENT 010 combobox.text = '' 011 button.align = Phi::AL_RIGHT 012 013 combobox.items.add('ほげ') 014 combobox.items.add('ふが') 015 combobox.items.add('にゅう') 016 017 button.on_click = proc do 018 print combobox.text, "\r\n" 019 end 020 021 form.show 022 Phi.mainloop