Module: Tk::Scrollable

Instance Method Summary collapse

Methods included from YScrollable

#yscrollbar, #yscrollcommand, #yview, #yview_moveto, #yview_scroll

Methods included from XScrollable

#xscrollbar, #xscrollcommand, #xview, #xview_moveto, #xview_scroll

Instance Method Details

#autoscroll(mode = nil) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/tkextlib/tcllib/autoscroll.rb', line 65

def autoscroll(mode = nil)
  case mode
  when :x, 'x'
    if @xscrollbar
      Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar)
    end
  when :y, 'y'
    if @yscrollbar
      Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar)
    end
  when nil, :both, 'both'
    if @xscrollbar
      Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar)
    end
    if @yscrollbar
      Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar)
    end
  else
    fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected"
  end
  self
end

#unautoscroll(mode = nil) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/tkextlib/tcllib/autoscroll.rb', line 87

def unautoscroll(mode = nil)
  case mode
  when :x, 'x'
    if @xscrollbar
      Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar)
    end
  when :y, 'y'
    if @yscrollbar
      Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar)
    end
  when nil, :both, 'both'
    if @xscrollbar
      Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar)
    end
    if @yscrollbar
      Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar)
    end
  else
    fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected"
  end
  self
end