ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 21日 (水) 06:16:26 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-tb ------------------------- @@ -508,6 +508,15 @@ === Orientation Of Detached Toolbar + +If you just used the Gtk::HandleBox widget to detach your toolbar without any additional code that alters the properties of your toolbar object, particularly if you neglected setting its size with Gtk::Widget#size_request method, it would detach into a default detached Gtk arrow toolbar item form that is most likely also rather useless. So if you plan to detach your toolbar you should make sure it would have a acceptable size. To warn you about this eventuality, in our code you will find the following: + + # ... make sure you uncomment the following line! + #toolbar.set_size_request(600, -1) # -- Important, otherwise only arrow + # item box would be moved out! + +Moving the toolbar out of the window, when by this action you do not gain a bigger working area, is most likely a result of your desire to visually rearrange the screen layout. You accomplish this by setting toolbar's orientation attribute. That is what we did in our program example above. What is interesting is, that we did this in the signal handler callbacks, reacting to((*'child-detached'*))and ((*'child-attached'*))signals. When you think about it, this makes perfect sence. However for learning purposes you may try to simply detach your toolbar from the window without rearranging the orientation. To do this you can comment out the signal handling code as shown with the '=begin' and '=end' keywords in the following code snippet. However, make sure you do not forget or overlook the 'set_size_request' method. + # Create handle box wrapper # ----------------------------------------------------------------------- handle = Gtk::HandleBox.new @@ -535,7 +544,15 @@ toolbar.set_size_request(300, -1) # -- Important, otherwise only arrow # item box would be moved out! - handle.add(toolbar) vbox = Gtk::VBox.new(false, 5) vbox.pack_start_defaults(handle)