Methods
B
H
I
S
V
Included Modules
Constants
DEFAULT_WIDTH = 200
 
DEFAULT_HEIGHT = 200
 
Instance Public methods
bind(*args)

forbid to change binding of @base frame

# File ext/tk/sample/scrollframe.rb, line 159
def bind(*args)
  @frame.bind(*args)
end
bind_append(*args)
# File ext/tk/sample/scrollframe.rb, line 162
def bind_append(*args)
  @frame.bind_append(*args)
end
bind_remove(*args)
# File ext/tk/sample/scrollframe.rb, line 165
def bind_remove(*args)
  @frame.bind_remove(*args)
end
bindinfo(*args)
# File ext/tk/sample/scrollframe.rb, line 168
def bindinfo(*args)
  @frame.bindinfo(*args)
end
hscroll(mode)

horizontal scrollbar : ON/OFF

# File ext/tk/sample/scrollframe.rb, line 198
def hscroll(mode)
  Tk.update_idletasks
  st = TkGrid.info(@h_scroll)
  if mode && st.size == 0 then
    _reset_scrollregion(true, nil)
  elsif !mode && st.size != 0 then
    _reset_scrollregion(false, nil)
  else
    _reset_scrollregion(nil, nil)
  end
  self
end
initialize_composite(keys={})
# File ext/tk/sample/scrollframe.rb, line 24
def initialize_composite(keys={})
  @frame.configure(:width=>DEFAULT_WIDTH, :height=>DEFAULT_HEIGHT)

  # create scrollbars
  @h_scroll = TkScrollbar.new(@frame, 'orient'=>'horizontal')
  @v_scroll = TkScrollbar.new(@frame, 'orient'=>'vertical')

  # create a canvas widget
  @canvas = TkCanvas.new(@frame,
                         :borderwidth=>0, :selectborderwidth=>0,
                         :highlightthickness=>0)

  # allignment
  TkGrid.rowconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0)
  TkGrid.columnconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0)
  @canvas.grid('row'=>0, 'column'=>0, 'sticky'=>'news')
  @frame.grid_propagate(false)

  # assign scrollbars
  @canvas.xscrollbar(@h_scroll)
  @canvas.yscrollbar(@v_scroll)

  # convert hash keys
  keys = _symbolkey2str(keys)

  # check options for the frame
  framekeys = {}
  if keys.key?('classname')
     keys['class'] = keys.delete('classname')
  end
  if @classname = keys.delete('class')
    framekeys['class'] = @classname
  end
  if @colormap  = keys.delete('colormap')
    framekeys['colormap'] = @colormap
  end
  if @container = keys.delete('container')
    framekeys['container'] = @container
  end
  if @visual    = keys.delete('visual')
    framekeys['visual'] = @visual
  end
  if @classname.kind_of? TkBindTag
    @db_class = @classname
    @classname = @classname.id
  elsif @classname
    @db_class = TkDatabaseClass.new(@classname)
  else
    @db_class = self.class
    @classname = @db_class::WidgetClassName
  end

  # create base frame
  @base = TkFrame.new(@canvas, framekeys)

  # embed base frame
  @cwin = TkcWindow.new(@canvas, [0, 0], :window=>@base, :anchor=>'nw')
  @canvas.scrollregion(@cwin.bbox)

  # binding to reset scrollregion
  @base.bind('Configure'){ _reset_scrollregion(nil, nil) }

  # set default receiver of method calls
  @path = @base.path

  # scrollbars ON
  vscroll(keys.delete('vscroll'){true})
  hscroll(keys.delete('hscroll'){true})

  # please check the differences of the following definitions
  option_methods(
    :scrollbarwidth
  )

  # set receiver widgets for configure methods (with alias)
  delegate_alias('scrollbarrelief', 'relief', @h_scroll, @v_scroll)

  # set receiver widgets for configure methods
  delegate('DEFAULT', @base)
  delegate('background', @frame, @base, @canvas, @h_scroll, @v_scroll)
  delegate('width', @frame)
  delegate('height', @frame)
  delegate('activebackground', @h_scroll, @v_scroll)
  delegate('troughcolor', @h_scroll, @v_scroll)
  delegate('repeatdelay', @h_scroll, @v_scroll)
  delegate('repeatinterval', @h_scroll, @v_scroll)
  delegate('borderwidth', @frame)
  delegate('relief', @frame)

  # do configure
  configure keys unless keys.empty?
end
scrollbarwidth(width = nil)

set width of scrollbar

# File ext/tk/sample/scrollframe.rb, line 173
def scrollbarwidth(width = nil)
  if width
    @h_scroll.width(width)
    @v_scroll.width(width)
  else
    @h_scroll.width
  end
end
vscroll(mode)

vertical scrollbar : ON/OFF

# File ext/tk/sample/scrollframe.rb, line 183
def vscroll(mode)
  Tk.update_idletasks
  st = TkGrid.info(@v_scroll)
  if mode && st.size == 0 then
    @v_scroll.grid('row'=>0, 'column'=>1, 'sticky'=>'ns')
    _reset_scrollregion(nil, true)
  elsif !mode && st.size != 0 then
    _reset_scrollregion(nil, false)
  else
    _reset_scrollregion(nil, nil)
  end
  self
end