Working with drop settings
Open the settings for the Container Icon Tree part in the Discard Window part and go to the Drag Drop Spec window. Select the Image Drag Drop Spec data type, set canBeDragTarget to true, select XmCOPY for defaultDropOperations and, for the dropAcceptableClassList property, add Card to the ordered collection of acceptable classes. Select OK to accept the changes.
Test your part again. You still cannot drop a card on the Discard window. This is because the Deck window wants to do a move operation and the Discard window wants to do a copy operation. The two windows cannot agree on on operation. The two parts must agree on the default drop operation for a drop to occur.
Close your test windows.
Open the Drag Drop Spec window for the Container Icon Tree part again and select XmMOVE for defaultDropOperations. Leave XmCOPY selected as well. This makes both move and copy valid drop operations. Select OK to accept the changes.
Test your part again. This time you can drop cards in the Discard window. Notice that the cards were moved because both parts agree on this operation. Also notice that the cards are not in a tree view. This is because no direct connection exists between the Discard Window part's container and the Discard Deck part. Instead, these parts are connected indirectly through a script.
Open the settings for the Container Icon List part in the Deck Window part and switch to the Drag Drop Spec window. Set canBeDragTarget to true, specify XmMOVE and XmCOPY for defaultDragOperations, specify XmMOVE and XmCOPY for defaultDropOperations, and add Card to the ordered collection of acceptable classes. Select OK to accept the changes.
Change the Drag Drop Spec settings for the Container Icon Tree part to allow a drag with a default operation of XmMOVE. Also, ensure that the part allows both an XmMOVE and an XmCOPY default operation on a drop. Select the OK to accept the changes.
Test your part again. Drag multiple cards from the Deck window to the Discard window while holding the Ctrl key. Notice that a small + appears by the mouse pointer indicating a copy operation. Drop the cards in the Discard window. Notice that the cards are copied and not moved because the drag operation was augmented by the Ctrl key. Pressing the Ctrl key during a drag operation indicates that you want to perform a copy operation.
Try dragging the cards back to the Deck window while holding the Ctrl key. A drop is forbidden because the Discard window doesn't allow a copy operation when acting as a drag source.
Try dragging the cards back again without holding the Ctrl key. This time the cards are moved and you now have multiple cards of the same suit and value in the Deck window.
Last modified date: 01/29/2015