B4J Question [Solved] Help with Drag and Drop

MrKim

Well-Known Member
Licensed User
Longtime User
I am at a loss how to get the Node that is being dragged from the _DragDetected event. Sender doesn't appear to work in _DragDetected. I
was getting it from the _MousePressed event because that is the only thing that seems to happen before _DragDetected. However I switched to a BBCodeView because I want the property and it doesn't have a _MousePressed event. The items are in a customlistview and I need to know which item I am dragging as soon as the _DragDetected event happens. The data there tells me which Form to bring to the foreground to drag TO. Any help/ideas appreciated. I tried the CLV click event, but it too doesn't happen until after _DragDetected.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Try
B4X:
e.As(JavaObject).RunMethod("getSource",Null)

The event passed to the _DragDetected sub is a MouseEvent.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Try
B4X:
e.As(JavaObject).RunMethod("getSource",Null)

The event passed to the _DragDetected sub is a MouseEvent.
Sub DandD1_DragDetected(e As MouseEvent):
Sub DandD1_DragDetected(e As MouseEvent)
Try
    Dim P As Pane = e.As(JavaObject).RunMethod("getSource",Null)
    ActiveMap = P.Tag

Worked perfectly, Thank you.
I wonder why Sender doesn't work.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I wonder why Sender doesn't work.
Because the library is not a java library it's written in B4x and the event first goes to the wrapped draganddrop class and is then passed on to the class in which it was defined. The sender will be the draganddrop class.
 
Upvote 0
Top