Sha256: 8ad0cce5274cdc76f8aac9091f421bd12c0ef84ddc211ebc96c7fc03a1cbb145

Contents?: true

Size: 1.03 KB

Versions: 184

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
=begin
  dialog2.rb - Ruby/GTK2 sample script.

  Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.

  $Id: dialog2.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $
=end

require 'gtk2'

window = Gtk::Window.new("Gtk::Dialog sample2")
button = Gtk::Button.new("Create Dialog")
button.signal_connect("clicked") do 
  dialog = Gtk::Dialog.new("Gtk::Dialog Sample 2", window, 
                           Gtk::Dialog::MODAL|Gtk::Dialog::NO_SEPARATOR,
                           [Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK],
                           [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
  dialog.vbox.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
  dialog.set_default_size(300, 300)
  dialog.vbox.show_all
  result = dialog.run
  case result
  when Gtk::Dialog::RESPONSE_OK
    p "OK"
  when Gtk::Dialog::RESPONSE_CANCEL
    p "Cancel"
  end
  dialog.destroy
end

window.add(button).show_all.signal_connect("destroy"){Gtk.main_quit}

Gtk.main


                         

Version data entries

184 entries across 184 versions & 1 rubygems

Version Path
gtk2-3.4.3 sample/misc/dialog2.rb
gtk2-3.4.2 sample/misc/dialog2.rb
gtk2-3.4.1 sample/misc/dialog2.rb
gtk2-3.4.0 sample/misc/dialog2.rb
gtk2-3.3.9 sample/misc/dialog2.rb
gtk2-3.3.8 sample/misc/dialog2.rb
gtk2-3.3.7 sample/misc/dialog2.rb
gtk2-3.3.6 sample/misc/dialog2.rb
gtk2-3.3.5 sample/misc/dialog2.rb
gtk2-3.3.4 sample/misc/dialog2.rb
gtk2-3.3.3 sample/misc/dialog2.rb
gtk2-3.3.2 sample/misc/dialog2.rb
gtk2-3.3.1 sample/misc/dialog2.rb
gtk2-3.3.0 sample/misc/dialog2.rb
gtk2-3.2.9-x64-mingw32 sample/misc/dialog2.rb
gtk2-3.2.9-x86-mingw32 sample/misc/dialog2.rb
gtk2-3.2.9 sample/misc/dialog2.rb
gtk2-3.2.8-x64-mingw32 sample/misc/dialog2.rb
gtk2-3.2.8-x86-mingw32 sample/misc/dialog2.rb
gtk2-3.2.8 sample/misc/dialog2.rb