class ScrolledWindowSample

Public Class Methods

new() click to toggle source
Calls superclass method SampleDialog.new
# File gtk2/sample/testgtk/scrolledwindow.rb, line 36
def initialize
  super("dialog")

  scrolled_window = Gtk::ScrolledWindow.new
  scrolled_window.border_width = 10
  scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC,
                             Gtk::POLICY_AUTOMATIC)
  vbox.add(scrolled_window)

  table = Gtk::Table.new(20, 20, false)
  table.row_spacings = 10
  table.column_spacings = 10
  scrolled_window.add_with_viewport(table)

  table.focus_hadjustment = scrolled_window.hadjustment
  table.focus_vadjustment = scrolled_window.vadjustment

  for i in 0..19
    for j in 0..19
      buffer = "button (#{i},#{j})"
      button = Gtk::ToggleButton.new(buffer)
      table.attach(button, i, i + 1, j, j + 1)
    end
  end

  button = Gtk::Button.new("close")
  button.signal_connect("clicked"){destroy}
  action_area.pack_start(button, true, true, 0)

  set_default_size(300, 300)
end