Sha256: a2772ff7c8e7a91599ec357e27ec99dfaba41e6046c8519771cfe8b16ba28c7f

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 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 "gtk3"

window = Gtk::Window.new("Gtk::Dialog sample2")
button = Gtk::Button.new(:label => "Create Dialog")
button.signal_connect("clicked") do
  dialog = Gtk::Dialog.new(:title =>"Gtk::Dialog Sample 2",
                           :parent => window,
                           :flags => Gtk::Dialog::Flags::MODAL,
                           :buttons => [[Gtk::Stock::OK, Gtk::ResponseType::OK],
                           [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]])
  dialog.child.add(Gtk::Label.new("Gtk::Dialog Sample 2"))
  dialog.set_default_size(300, 300)
  dialog.child.show_all
  result = dialog.run
  case result
  when Gtk::ResponseType::OK
    p "OK"
  when Gtk::ResponseType::CANCEL
    p "Cancel"
  end
  dialog.destroy
end

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

Gtk.main

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gtk3-2.2.5-x64-mingw32 sample/misc/dialog2.rb
gtk3-2.2.5-x86-mingw32 sample/misc/dialog2.rb
gtk3-2.2.5 sample/misc/dialog2.rb
gtk3-2.2.4-x64-mingw32 sample/misc/dialog2.rb
gtk3-2.2.4-x86-mingw32 sample/misc/dialog2.rb
gtk3-2.2.4 sample/misc/dialog2.rb
gtk3-2.2.3-x86-mingw32 sample/misc/dialog2.rb
gtk3-2.2.3 sample/misc/dialog2.rb
gtk3-2.2.2-x86-mingw32 sample/misc/dialog2.rb
gtk3-2.2.2 sample/misc/dialog2.rb
gtk3-2.2.1-x86-mingw32 sample/misc/dialog2.rb
gtk3-2.2.1 sample/misc/dialog2.rb