# File gtk/sample/gtk-demo/sizegroup.rb, line 24
    def initialize
      super('GtkSizeGroup', nil, 0,
            [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_NONE])

      color_options = %w(Red Green Blue)
      dash_options = %w(Solid Dashed Dotted)
      end_options = %w(Square Round Arrow)

      set_resizable(false)

      signal_connect('response') do
        destroy
      end

      vbox = Gtk::VBox.new(false, 5)
      self.vbox.pack_start(vbox, true, true, 0)
      vbox.set_border_width(5)

      size_group = Gtk::SizeGroup.new(Gtk::SizeGroup::HORIZONTAL)

      ## Create one frame holding color options
      frame = Gtk::Frame.new('Color Options')
      vbox.pack_start(frame, true, true, 0)

      table = Gtk::Table.new(2, 2, false)
      table.set_border_width(5)
      table.set_row_spacings(5)
      table.set_column_spacings(10)
      frame.add(table)

      add_row(table, 0, size_group, '_Foreground', color_options)
      add_row(table, 1, size_group, '_Background', color_options)

      ## And another frame holding line style options
      frame = Gtk::Frame.new('Line Options')
      vbox.pack_start(frame, false, false, 0)

      table = Gtk::Table.new(2, 2, false)
      table.set_border_width(5)
      table.set_row_spacings(5)
      table.set_column_spacings(10)
      frame.add(table)

      add_row(table, 0, size_group, '_Dashing', dash_options)
      add_row(table, 1, size_group, '_Line ends', end_options)

      # And a check button to turn grouping on and off
      check_button = Gtk::CheckButton.new('_Enable grouping', true)
      vbox.pack_start(check_button, false, false, 0)

      check_button.set_active(true)
      check_button.signal_connect('toggled', size_group) do |check_button, size_group|
        new_mode = if check_button.active?
                     Gtk::SizeGroup::HORIZONTAL
                   else
                     Gtk::SizeGroup::VERTICAL
                   end
        size_group.set_mode(new_mode)
      end
    end