ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 27日 (火) 07:15:18 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-dnd-intro ------------------------- @@ -81,7 +81,7 @@ === Builti-in DnD Tree View Mechanism -{{image_right("treeview-builtin-dnd.png")}} +{{image_right("treeview-builtin-dnd-s1.png")}} Our first example program will show that only with a line of code you can get the complete drag-and-drop behaviour for free. All you need is to set up the reorderable attribute to true, by using the 'Gtk::TreeView#reorderable=' method. The drag objects here are the tree view rows, regardless whether they are leaf or nodes with children. When you left-click, hold the mouse button down and drag the mouse simultaneously the cursor changes to the 'move-icon' and the row you are dragging appears underneath it. If you look carefully, when dragging, you will notice that a potential drop position is shown, namely, the items over which you are dragging the row get highlighted, and the when you are in-between i.e., above or below rows a line appears. If you are dropping the dragged row onto a highlighted row it will become it's child, but if you drop it when the line indicator is shown, the dragged item will be placed at that position.