B4J Question Drag&Drop with B4XTables - can not define target

DarkoT

Active Member
Licensed User
Hi guys,

need help. I want to implement drag & drop function which will work with columns in B4xTable. User should have possibility to organize order for view (based on B4xTable). I cannot find any solution which will solve the problem with drag & drop. System gives me event for dragging (when I start dragging), I cannot get event for target...

In Attachment you will find the demo project; If somebody can solve a problem, I will be more as thankful...

2023-03-27_09h52_26.gif


Best Regard, Darko
 

Attachments

  • TestPrj.zip
    24.9 KB · Views: 44
Solution
There were a couple of issues with the code:
1) It is easier to make the Source/Targets the separate panes instead of the clv it makes it easier to determine the source and target nodes.
2) You need to set the DragModeAndData in the clvSource_DragDetected sub so that the Target subs are called. You can use the DataID to determine if the drop is valid, or coming from somewhere else (I have now included that check).

My modifications now display the source and target Pane objects (and label text) once the drop is complete. I'll leave it to you to decide how to re-organize the table on drop.

MikeH

Well-Known Member
Licensed User
Longtime User
You could put a label behind New View and make that the drop target. Or you could find the .mbase of that view and use that.

p.s. Symptom is spelled with a "y"
 
Upvote 0

DarkoT

Active Member
Licensed User
You could put a label behind New View and make that the drop target. Or you could find the .mbase of that view and use that.

p.s. Symptom is spelled with a "y"
Thanks, will try... Also for spelling correction... ;) :p
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
There were a couple of issues with the code:
1) It is easier to make the Source/Targets the separate panes instead of the clv it makes it easier to determine the source and target nodes.
2) You need to set the DragModeAndData in the clvSource_DragDetected sub so that the Target subs are called. You can use the DataID to determine if the drop is valid, or coming from somewhere else (I have now included that check).

My modifications now display the source and target Pane objects (and label text) once the drop is complete. I'll leave it to you to decide how to re-organize the table on drop.
 

Attachments

  • TestPrj_SL.zip
    9.5 KB · Views: 44
Last edited:
Upvote 0
Solution

DarkoT

Active Member
Licensed User
There were a couple of issues with the code:
1) It is easier to make the Source/Targets the separate panes instead of the clv it makes it easier to determine the source and target nodes.
2) You need to set the DragModeAndData in the clvSource_DragDetected sub so that the Target subs are called. You can use the DataID to determine if the drop is valid, or coming from somewhere else (I have now included that check).

My modifications now display the source and target Pane objects (and label text) once the drop is complete. I'll leave it to you to decide how to re-organize the table on drop.
Thanks for solution... I found the problem with drag & Drop and it's solved.. But I have more categorical problem (maybe I just can not find correct example)... Thank you for your help..
Darko
 
Upvote 0
Top