Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 2 Jahren, 12 Monaten
Letzter Beitrag:
vor 2 Jahren, 12 Monaten
Beteiligte Autoren:
David Egan, DerekT, Allard, Stefan Bentvelsen

[WD20] Drag & Drop

Startbeitrag von David Egan am 20.08.2015 07: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

Antworten:

Re: [WD20] Drag & Drop

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

von Allard - am 20.08.2015 08:08

Re: [WD20] Drag & Drop

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

von David Egan - am 20.08.2015 20:28

Re: [WD20] Drag & Drop

Hi David,

I suppose you're looking for DnDCursor(dndNone). It prevents the drag and drop if set on the specific rows.

von Stefan Bentvelsen - am 20.08.2015 21:19

Re: [WD20] Drag & Drop

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

von David Egan - am 20.08.2015 23:07

Re: [WD20] Drag & Drop

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.

von DerekT - am 21.08.2015 08:35

Re: [WD20] Drag & Drop

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

von David Egan - am 21.08.2015 19:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.