Visualruby Now has Drag and Drop

Hi:

I’ve just added drag and drop to visualruby. I isn’t documented on
visualruby.net yet, but there is an example program in the latest
visualruby gem (0.1.2). Its pretty simple. You can do this:

label1 = Gtk::Label.new(“Hello World”)
label2 = Gtk::Label.new(“Goodbye”)
button1 = Gtk::Button.new(“I need a Label”)

label1.drag_to(button1)
label2.drag_to(button1)

Then you write a method for the action you want it to take:

def button1__drag_drop(*args)
source_label = button1.dragged_widget
button1.label = source_label.label
end

The instance variable, dragged_widget is added by visualruby in the drag
process. It holds a reference to the source widget.

Note: the method must be use the naming convention “widget__signal”

I’d like to hear input from you guys because I’m taking a very simple
approach: dragging one widget onto another then writing a handler. It
looks like the best solution to me. GTK has special drag-n-drop stuff
so you can drag treeview rows around, but I can’t get it to copy/move
records from one treeview to another:

http://www.ruby-forum.com/topic/127494

To see this work, go to visualruby.net, and download it using the
instructions. Open the “drag_drop” example.

Also, the program was having a problem on some machines when it scanned
the “home” directory for project files because some people had thousands
of files in their home directory causing a big pause. To correct this,
the program now creates a folder: home/visualruby to narrow the
search. However, now everyone will basically be required to keep all
their projects in the home/visualruby folder. Let me know if this is a
problem.

Thanks,
Eric C