[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-dnd-intro

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 12月 11日 (火) 13:21:56 JST


-------------------------
REMOTE_ADDR = 184.145.81.223
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dnd-intro
-------------------------
@@ -742,7 +742,7 @@
    	targets=Gtk::TargetList.new(TBDND_TARGETS), # [["toolbar", Gtk::Drag::TARGET_SAME_APP, 100]]
    	actions=TBDND_ACTIONS,                      # Gdk::DragContext::ACTION_ASK
    	button=e.button,
-   	e                      # Gdk::Event::DRAG_LEAVE
+   	event=e                      # Gdk::Event::DRAG_LEAVE
        )
      end
    end
@@ -840,9 +840,16 @@
      set_dnd_source_frame_widget(htbframe)
      set_dnd_destination_frame_widget(htbframe, vtbframe)  # (source_fr, dest_fr)
 
-The 'set_dnd_source_frame_widget(htbframe)' method is straight forward, nevertheless it contains a few perks that deserve special attention. The first one is unsetting a possible earlier registration as the destination. Indeed this is a dummy (or unnecessary, void) call when called during the instantiation of DndTbWindow class (i.e. when called from the initialize method). It only serves its purpose on subsequent calls, at the time a drag occurs (i.e. when 'button-press-event' occurs). This brings us to the second nuance (perk) namely, to the next line, in which we register our source widget (frame) as a listener or the signal handler for 'button-press-event' signals (remember the frames normally do not respond to these signals), so we first have to add (register) this event/signal for the frame, and then register this frame's callback proc (or block) to respond to emissions of these signals. When and if the 'button-press-event' occurs, we make this signal handler to finally
  register the widget as the dnd source.
+The 'set_dnd_source_frame_widget(htbframe)' method is straight forward, nevertheless it contains a few perks that deserve special attention. The first one is unsetting a possible earlier registration as the destination. Indeed this is a dummy (or unnecessary, void) call when called during the instantiation of DndTbWindow class (i.e. when called from the initialize method). It only serves its purpose on subsequent calls, at the time a drag occurs (i.e. when 'button-press-event' occurs). This brings us to the second nuance (perk) namely, to the next line, in which we register our source widget (frame) as a listener or the signal handler for 'button-press-event' signals (remember the frames normally do not respond to these signals), so we first have to add (register) this event/signal for the frame, and then register this frame's callback proc (or block) to respond to emissions of these signals. When and if the 'button-press-event' occurs, we make this signal handler to finally
  register the widget as the dnd source. The last perk is that we can not use the regular Gtk::Drag.source_set method to set up our source widget (frame), as we did in our 'button-to-label-dnd.rb' example.
 
 
+ Gtk::Drag.begin(
+     widget=w,
+     targets=Gtk::TargetList.new(TBDND_TARGETS), # [["toolbar", Gtk::Drag::TARGET_SAME_APP, 100]]
+     actions=TBDND_ACTIONS,                      # Gdk::DragContext::ACTION_ASK
+     button=e.button,
+     event=e                      # Gdk::Event::DRAG_LEAVE
+ )
 
 :Note:
-    The source dnd widget in our 'dnd-toolbar*.rb' programs do not respond to Gtk::Widget's ((*'drag-*'*))signals at all!
+    The source dnd widget in our 'dnd-toolbar*.rb' programs do not respond to Gtk::Widget's ((*'drag-*'*))signals at all, in fact these signals do not even provide button, and events parameters, we need to register a dnd source widget!




ruby-gnome2-cvs メーリングリストの案内
Back to archive index