ruby-****@sourc*****
ruby-****@sourc*****
2005年 9月 11日 (日) 22:45:05 JST
------------------------- REMOTE_ADDR = 81.62.195.160 REMOTE_HOST = REMOTE_USER = ruby-gnome2-hiki URL = /hiki.cgi?Gtk%3A%3ADialog ------------------------- @@ -15,6 +15,22 @@ For the simple dialog in the following example, in reality you'd probably use Gtk::MessageDialog to save yourself some effort. But you'd need to create the dialog contents manually if you had more than a simple message in the dialog. + # Function to open a dialog box displaying the message provided. + def quick_message(message) + # Create the dialog + dialog = Gtk::Dialog.new("Message", + $main_application_window, + Gtk::Dialog::DESTROY_WITH_PARENT, + [ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE ]) + + # Ensure that the dialog box is destroyed when the user responds. + dialog.signal_connect('response') { dialog.destroy } + + # Add the message in a label, and show everything we've added to the dialog. + dialog.vbox.add(Gtk::Label.new(message)) + dialog.show_all + end + == Object Hierarchy * Object * GLib::Instantiatable @@ -158,7 +174,25 @@ == Constants === GtkDialogFlags + --- MODAL + Call Gtk::Window#set_modal(true). --- DESTROY_WITH_PARENT Call Gtk::Window#set_destroy_with_parent.