If you ask in the Italian forum, you don't have to fight with English.
I don't think you're talking about the Designer, right?
If you want to change the parent of a View at runtime, you have to remove it from its current parent and then add it to the new one.
Dragging, you have to "intercept" the view on which you will drop the view dragged.
The Erel's example drags text files onto a TextArea, setting this as "dragging destination", without setting the "dragging source" (and it works as expected, as always).
In your case, @ivanomonti, I think you should set the "dragging source". I started trying so:
B4X:
Sub btnMoveMe_MousePressed (EventData As MouseEvent)
If EventData.SecondaryButtonPressed Then
Log("right button pressed")
DragAndDrop1.MakeDragSource(Sender, "DragSource")
' I don't know what parameters the SetDragModeAndData requires but I think it is necessary.
' DragAndDrop1.SetDragModeAndData(TransferMode.MOVE, Array As String("I don'tknow"), Array(Sender))
End If
End Sub
I think that without setting well that "SetDragModeAndData" the "dragging events" will not trigger (DragEntered, DragOver, DragExited and DragDropped).
No, it isn't. I did it roughly, it's not the right way.
In that test project the btnMoveMe Button is moved, while the project should be able to move any View.
The main problem is the type of the third parameter of the SetDragModeAndData method. In another example project I saw that an Image is passed to this method, so I passed what the method Snapshot of Button returns and this works but in the Drop event you cannot detect the real view dragged, the button.
Um... OK yes, Erel is a slacker, you know ? (false, he works too much, just we are on weekend), but I see that not even @stevel05 answers us (you, Ivano), unfortunately
The Java drag and drop Class is intended for use with Data. I haven't tried it with nodes. It may be possible to use part of it as a base, but it may also be easier to write the functionality as a new class. I will take a look a bit later.
The Java drag and drop Class is intended for use with Data. I haven't tried it with nodes. It may be possible to use part of it as a base, but it may also be easier to write the functionality as a new class. I will take a look a bit later.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.