require 'phi' require 'dialogs' form = Phi::Form.new(:form1, 'formです') button = Phi::Button.new(form, :button1, 'hoge') button.align = Phi::AL_CLIENT button.on_click = proc do dlg = Phi::OpenDialog.new dlg.filter = 'テキスト(*.txt)|*.txt|すべて(*.*)|*|' if dlg.execute path = File::expand_path(dlg.file_name) if FileTest::readable?(path) File::foreach(path) do |l| print l end else Phi::message_dlg("#{path}: 読みこむことが出来ません。", Phi::MT_ERROR, [Phi::MB_OK], 0) end end end form.show Phi.mainloop