PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD20] Drag & Drop
[WD20] Drag & Drop
Iniciado por guest, 20,ago. 2015 09:38 - 6 respuestas
Publicado el 20,agosto 2015 - 09:38
Hi
I have a treeview table as the (programmed) source for Drag & Drop. I need to prevent users from being able to drag an entry if it has a manifest number (a hidden column in the treeview table) associated with it. How do I do that?

Thanks

David
Publicado el 20,agosto 2015 - 10:08
Hi,

Two ways of doing this I guess
1
In the click proces you have to read the tree and figger out where you are in the tree. If you know where you are then you can check if it has a manifest number then you can programm the drag procedure to be disabled.

2
In the click proces of the tree . Find out where you are and based on that querie the file for the manifest number.

I havenot done this for a treeviewtable() but i did so for a treeview(). I qyess you would have to use tableselect() . Look in the help for how this function works

regards
Allard
Publicado el 20,agosto 2015 - 22:28
Thanks Allard
My problem was more how to disable the drag and drop for specific rows than how to determine whether it needed to be disabled. The only way I have found to do this is to use the WM_LBUTTONDOWN event & return -1 if there is a manifest. I'm just a little surprised that there's not a more direct way of doing this, or maybe I'm missing something.

Cheers

David
Publicado el 20,agosto 2015 - 23:19
Hi David,

I suppose you're looking for DnDCursor(dndNone). It prevents the drag and drop if set on the specific rows.
Publicado el 21,agosto 2015 - 01:07
Hi Stefan
That only seems to work on the drop side, which would achieve the same end result but I think it's better if it won't allow the drag in the first place.

Cheers

David
Publicado el 21,agosto 2015 - 10:35
David
I set a variable as True/False on row selection to determine whether DnD is valid.

In my procedure 'lpDD_OnDrag' I use this as.....
IF woTS.GS_RowValid = 1 THEN // Cursor indicating the move DnDCursor(dndMove) END to control the mouse cursor and DnD functionality.

This is on a Table
I guess you will need to determine if the selection is a node or a leaf and whether the leaf is valid to set the variable - pretty straight forward.
Publicado el 21,agosto 2015 - 21:49
Derek
Thankyou, thankyou, thankyou! That is the right approach; I had set my DndSource globally but by turning that on or off in the row selection it works exactly as I wanted.

Cheers

David