require 'phi' form = Phi::Form.new(:form1, 'フォームです') edit = Phi::Edit.new(form, :edit1, '') edit.align = Phi::AL_BOTTOM treeview = Phi::TreeView.new(form, :treeview1, '') treeview.align = Phi::AL_CLIENT nodes = treeview.items nodes.add(nil, '1') nodes.add(nil, '2') child_node = nodes.add(nil, '3') nodes.add_child(child_node, '3-1') nodes.add_child(child_node, '3-2') nodes.add_child(child_node, '3-3') treeview.on_click = proc do unless treeview.selected.nil? edit.text = treeview.selected.text end end form.show Phi.mainloop