ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 27日 (土) 10:43:14 JST
------------------------- REMOTE_ADDR = 74.14.158.59 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-mnstbs-statb ------------------------- @@ -73,7 +73,7 @@ {{image_left("statbar-state.png")}} -The((*enter-notify-event*))and((*leave-notify-event*)) signals in our example program here are handled by the 'statusbar_hint' method. For both signals, the handler receives Gdk::Event object as a parameter which is used to identify whether the cursor entered the menu item (Gdk::Event::ENTER_NOTIFY) or is on its way out (see: Gdk::Event::GdkEventType). We can use this information to, for as long as the cursor is hovering above the menu item, display the description of the menu selection in the status bar, by pushing our menu item description message on the status bar stack, hence hiding, for the time being, whatever was displayed there before the cursor entered the menu item. When the cursor leaves the menu item area, this time the((*leave-notify-event*))signal is emitted, carrying Gdk::Event::LEAVE_NOTIFY flag with it in Gdk::Event object, so we pop-off the stack the message we pushed on it when the cursor appeared above our menu item, which finally restores whatever messag e was on the status bar stack before the two consecutive ((*enter_notify_event*))signal emissions. +The((*enter-notify-event*))and((*leave-notify-event*)) signals in our example program here are handled by the 'statusbar_hint' method. For both signals, the handler receives Gdk::Event object as a parameter which, allows to use for both of these events the same 'statusbar_hint' handler method. In it we use the Gdk::Event object and Gdk::Event#event_type instance method to identify whether the cursor is entering the menu item (Gdk::Event::ENTER_NOTIFY) or is on its way out (see: Gdk::Event::GdkEventType). We can use this information to, for as long as the cursor is hovering above the menu item, display the description of the menu selection in the status bar, by pushing our menu item description message on the status bar stack, hence hiding, for the time being, whatever was displayed there before the cursor entered the menu item. When the cursor leaves the menu item area, this time the((*leave-notify-event*))signal is emitted, carrying Gdk::Event::LEAVE_NOTIFY flag with it in Gdk::Event object, so we pop-off the stack the message we pushed on it when the cursor appeared above our menu item, which finally restores whatever message was on the status bar stack before the two consecutive ((*enter_notify_event*))signal emissions.