ruby gtk dialog

L

Luke Worth

Hi. I'm writing this just as i'm about to implode - (really really
tired)

ok basically, I have a Gtk::TreeView which is nicely displaying a tree
for me. I want to be able to edit the data in each row. The way thought
of doing this was to use a Gtk::Dialog with an editable TextView. This
is because i need it to edit multiple line text.

Now, I can't for the life of me figure out how to use this thing;

def edit_row
dialog = Gtk::Dialog.new('Edit', @window['window'],
Gtk::Dialog::MODAL | Gtk::Dialog::DESTROY_WITH_PARENT,
[Gtk::Stock::OK, Gtk::Dialog::RESPONSE_ACCEPT],
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_REJECT])
text_buffer = Gtk::TextBuffer.new
text_view = Gtk::TextView.new(text_buffer)
text_view.visible = true

dialog.vbox.add(text_view)
dialog.run do |response|
if response == Gtk::Dialog::RESPONSE_ACCEPT
puts text_buffer.text
end
end
end

and when i run my program, i get a dialog with a nice text field with 2
completely useless buttons at the bottom labelled ok and cancel. How do
i make these buttons actually do something?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top