class DialogDemo
# Copyright © 2015-2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. #
Dialogs and Message Boxes¶ ↑
Dialog widgets are used to pop up a transient window for user feedback.
Public Class Methods
new(main_window)
click to toggle source
# File gtk3/sample/gtk-demo/dialog.rb, line 10 def initialize(main_window) @window = Gtk::Window.new(:toplevel) @window.screen = main_window.screen @window.title = "Dialogs and Message Boxes" frame = Gtk::Frame.new("Dialogs") frame.margin = 8 @window.add(frame) vbox = Gtk::Box.new(:vertical, 8) vbox.margin = 8 frame.add(vbox) # Standard message dialog hbox = Gtk::Box.new(:horizontal, 8) vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) button = initialize_standard_message_button hbox.pack_start(button, :expand => false, :fill => false, :padding => 0) vbox.pack_start(Gtk::Separator.new(:horizontal), :expand => false, :fill => false, :padding => 0) # Interactive dialog hbox = Gtk::Box.new(:horizontal, 8) vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0) vbox2 = Gtk::Box.new(:vertical, 0) hbox.pack_start(vbox2, :expand => false, :fill => false, :padding => 0) button = initialize_interactive_message_button vbox2.pack_start(button, :expand => false, :fill => false, :padding => 0) table, @entry1, @entry2 = initialize_grid_with_entries hbox.pack_start(table, :expand => false, :fill => false, :padding => 0) end
Public Instance Methods
run()
click to toggle source
# File gtk3/sample/gtk-demo/dialog.rb, line 47 def run if !@window.visible? @window.show_all else @window.destroy end @window end