mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/lib/tk/scrollbar.rb: When 'set' operation, a scrollbar cannot
propagate view port information from the source widget (that calls 'set') to other assigned widgets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
046d4e7ee1
commit
c2f8cec766
2 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Oct 7 23:47:57 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/scrollbar.rb: When 'set' operation, a scrollbar
|
||||||
|
cannot propagate view port information from the source widget
|
||||||
|
(that calls 'set') to other assigned widgets.
|
||||||
|
|
||||||
Thu Oct 7 17:36:25 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Thu Oct 7 17:36:25 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tk.rb: When CHILDKILLED and so on, Tk.errorCode returns
|
* ext/tk/lib/tk.rb: When CHILDKILLED and so on, Tk.errorCode returns
|
||||||
|
|
|
@ -29,6 +29,15 @@ class TkScrollbar<TkWindow
|
||||||
end
|
end
|
||||||
private :create_self
|
private :create_self
|
||||||
|
|
||||||
|
def propagate_set(src_win, first, last)
|
||||||
|
self.set(first, last)
|
||||||
|
if self.orient == 'horizontal'
|
||||||
|
@assigned.each{|w| w.xview('moveto', first) if w != src_win}
|
||||||
|
else # 'vertical'
|
||||||
|
@assigned.each{|w| w.yview('moveto', first) if w != src_win}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def assign(*wins)
|
def assign(*wins)
|
||||||
begin
|
begin
|
||||||
self.command(@scroll_proc) if self.cget('command').cmd != @scroll_proc
|
self.command(@scroll_proc) if self.cget('command').cmd != @scroll_proc
|
||||||
|
@ -39,9 +48,9 @@ class TkScrollbar<TkWindow
|
||||||
wins.each{|w|
|
wins.each{|w|
|
||||||
@assigned << w unless @assigned.index(w)
|
@assigned << w unless @assigned.index(w)
|
||||||
if orient == 'horizontal'
|
if orient == 'horizontal'
|
||||||
w.xscrollcommand proc{|first, last| self.set(first, last)}
|
w.xscrollcommand proc{|first, last| self.propagate_set(w, first, last)}
|
||||||
else # 'vertical'
|
else # 'vertical'
|
||||||
w.yscrollcommand proc{|first, last| self.set(first, last)}
|
w.yscrollcommand proc{|first, last| self.propagate_set(w, first, last)}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
Tk.update # avoid scrollbar trouble
|
Tk.update # avoid scrollbar trouble
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue