What Happens at Drop Time?

When the user drags a DropTool out of the
DropTools Palette
and onto a stack, the following actions take place:

 

  1. Notify DropTool Stack:
    The DropTools_PreDragDrop message is dispatched to card 1 of the DropTool stack before any objects are copied or other actions are taken. This allows you to take a pre-drop action. (Note: If you want to allow the rest of the following actions to happen, you will need to pass the DropTools_PreDragDrop message.)
  2. Generate Unique Name:
    A unique name for the dropped control is generated using the format "<dropToolType> <Number>", so the first "MyControl" instance dropped is named "MyControl 1", the second on the same card "MyControl 2", etc.
  3. Check For Library:
    The DropTool stack is opened invisibly, and a check is made for a substack called "<dropToolType> Library". If it exists, the user is told that a library is required and (assuming they agree to the installation), the library substack is cloned, renamed as "lib<dropToolType>", is saved to disk, and then brought into use. (If you specified you wanted the library to have substacks, those are copied and inserted as well before the library is saved.)
  4. Check For Behavior:
    A check is made to determine if the DropTool has a behavior, by looking at the DropTool stack to see if there is a button named "<dropToolType> Behavior" (and if not, it will check for "<dropToolType> Behaviour", "<dropToolType> Class", or any of these three without the space). If it does not find a behavior button, it will see if the custom control itself already has a behavior attached to it and will try to identify the button that has the behavior. Either way if a behavior is identified, it will be noted for a later step.
  5. Copy DropTool:
    The group on the DropTool stack called "<dropToolType>" is copied to the currently displayed card of the target stack.
  6. Determine Resource Location:
    First, a check is made to see if the user has defined a Custom Install Location. If not, a check is made to see if the target stack has a substack that starts with "DropTools_"; if not, a substack is created in the target stack called "DropTools_<milliseconds>" in order to keep the stack name unique. A check is made to see if this substack has a card in it named "<dropToolType>". If so, then it is assumed that another instance of the control has been installed previously, so it does not copy any resources. If not, it creates a card named "<dropToolType>". This will be where all other objects (resources) are copied, unless the user has specified a custom location (see "Advanced Options" on the User Guide page for more info). This will be called the "ResourceCard".
  7. Copy Resources:
    All of the objects on the first card of the DropTool stack are copied to the ResourceCard, with the exception of the "<dropToolType>" group itself, the "<dropToolType> Icon" image, if there is one, and any card objects whose
    uDTDontCopy
    property is set to "true".
  8. Reconnect Icons:
    Any images used in the dropped control are reconnected with the images copied over in the previous step. (This is because the act of copying images, even those in groups, will cause those image IDs to change. So in order to make sure the custom control looks and works properly, the DropTools Palette will keep track of what images are being used in the control and will change the IDs of the images used by the dropped instance of the control to match the new IDs of the images that were copied over.)
  9. Reassign Behavior:
    If a behavior for the control was identified earlier, it is attached to the dropped instance of the control.
  10. Select Control:
    The dropped instance of the control is selected with the pointer tool.
  11. Notify DropTool Stack:
    The DropTools_DragDrop message is dispatched to card 1 of the DropTool stack. This allows you to take a post-drop action, such as displaying an about box or licensing info, copying over other resources, instantiating front or backscripts, or even to check to see if necessary resources/stacks are available.
  12. Close DropTool Stack:
    The DropTool stack is then closed and removed from memory.
  13. Notify DropTool Instance:
    The DropTools_DragDrop message is dispatched to the dropped instance of the control, allowing you to take an instance-specific post-drop action, such as initializing the control.
 
© 2015 Sons of Thunder Software, Inc.