diff options
Diffstat (limited to 'ext/tk/lib/tk/scrollable.rb')
-rw-r--r-- | ext/tk/lib/tk/scrollable.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb index e591a299ab..c5f4fdb70c 100644 --- a/ext/tk/lib/tk/scrollable.rb +++ b/ext/tk/lib/tk/scrollable.rb @@ -7,10 +7,15 @@ module Tk module Scrollable def xscrollcommand(cmd=Proc.new) configure_cmd 'xscrollcommand', cmd + # Tk.update # avoid scrollbar trouble + self end def yscrollcommand(cmd=Proc.new) configure_cmd 'yscrollcommand', cmd + # Tk.update # avoid scrollbar trouble + self end + def xview(*index) if index.size == 0 list(tk_send_without_enc('xview')) @@ -19,6 +24,13 @@ module Tk self end end + def xview_moveto(*index) + xview('moveto', *index) + end + def xview_scroll(*index) + xview('scroll', *index) + end + def yview(*index) if index.size == 0 list(tk_send_without_enc('yview')) @@ -27,6 +39,13 @@ module Tk self end end + def yview_moveto(*index) + yview('moveto', *index) + end + def yview_scroll(*index) + yview('scroll', *index) + end + def xscrollbar(bar=nil) if bar @xscrollbar = bar @@ -34,6 +53,7 @@ module Tk self.xscrollcommand {|*arg| @xscrollbar.set(*arg)} @xscrollbar.command {|*arg| self.xview(*arg)} end + Tk.update # avoid scrollbar trouble @xscrollbar end def yscrollbar(bar=nil) @@ -43,6 +63,7 @@ module Tk self.yscrollcommand {|*arg| @yscrollbar.set(*arg)} @yscrollbar.command {|*arg| self.yview(*arg)} end + Tk.update # avoid scrollbar trouble @yscrollbar end end |