ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 14日 (金) 07:06:13 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-scrolledwin ------------------------- @@ -155,7 +155,7 @@ The following listing demonstrates how to use scrolled windows and viewports, and how the two relate to each other. The program is called "viewports-w2tables.rb", because it implements two scolling tables. However, what is interesting is that only one of the two tables is adorned with scrollbars, and even more peculiar is that these very same scrolbars are actually scrolling both tables. (Not that you will often or ever need to do such a thing, we nevertheless include this program in the tutorial, since it does expose hidden relationship between these widgets to us). -As the scrollbar is moved, the viewport will scroll as well because adjustments are synchronized. Namely, new scrolled windows are created with: Gtk::ScrolledWindow.new(hadjustment = nil, vadjustment = nil), where the two arguments are the scrolled window's adjustments; these will be shared with the scrollbars and the child widget keeping the two widgets in sync. Note, that unlike for Gtk::Viewport.new, where you must always specify all arguments, even when they are nil, for Gtk::ScrolledWindow.new, you must always supply both adjustment arguments. So so if you previously created adjustments, obviously, you supply them to Gtk::ScrolledWindow.new method, however if you would like the scrolled window to create them for you, then you do not have to specify any arguments at all, hence using the default nil(s) instead. +As the scrollbar is moved, the viewport will scroll as well because adjustments are synchronized. Namely, new scrolled windows are created with: Gtk::ScrolledWindow.new(hadjustment = nil, vadjustment = nil), where the two arguments are the scrolled window's adjustments; these will be shared with the scrollbars and the child widget keeping the two widgets in sync. Note, that unlike for Gtk::Viewport.new, where you must always specify all arguments, even when they are nil, for Gtk::ScrolledWindow.new, you do not have to supply both adjustment arguments. So so if you previously created adjustments, obviously, you supply them to Gtk::ScrolledWindow.new method, however if you would like the scrolled window to create them for you, then you do not have to specify any arguments at all, hence using the default nil(s) instead. In our example the adjustments are used when viewport is created with Gtk::Viewport.new(horizontal, vertical). The viewport adjustments are initialized with those from the scrolled window, ensuring that both containers will be scrolled at the same time.