Drag Field Element and Trigger onDrop method

Is it possible to drag a Field element and drop it on a form, which will trigger the onDrop method?

I would like to drag any component such as a field, button, or combobox and drop it to any form. Is this possible?

I was hoping if this is possible, it would trigger the onDrop method of the form.

yes, but you must make sure that the target form
is accepting drops, by returning true in its onDragOver method

Is it possible to display the outer-lines of the field that is being dragged like you see when dragging an object in eclipse?

[attachment=0]drag_outline.PNG[/attachment]

Regards,

Peter

no, you can’t change the image used for showing the drag operation;
btw, we do have support for moving elements inside a form ( not between them),
using controller.setDesignMode, I think you want to make something similar using
the d&d functions on a form, but what is working on multiple forms ?

Thanks, Gabi. It’s working now.

I have another question. I was able to drag the textfield element and drop it on the form. I wanted to get information about the textfield like its name, titleText, etc. However, when I inspected the event only the following information is displayed.

JSDNDEvent(
type = onDrop, source = org.mozilla.javascript.NativeJavaObject@1c7ae27, formName = form_test, elementName = form_background, timestamp = Fri Sep 30 10:43:08 EST 2011,modifiers = 2,x =86,y = 40,data = null,dataMimeType = application/x-servoy-object; class=java.lang.Object,dragResult = 0
) 
{
   data:null,dataMimeType:"application/x-servoy-object; class=java.lang.Object"
}

Is there a way to get some information from the Servoy element that was dragged from the onDrop(event) method?

you should keep the info needed onDrop, when onDrag is started in a variable,
or, you can save it in the data property of the event, when drag is started, so
it will be available as data in the drop event

It worked! I used the data variable of the event to store it. Thanks very much!