Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Script functions, objects and attributes > Script templates > Script template for on drop scripts for diagrams
  
Script template for on drop scripts for diagrams
This topic provides a template of the empty functions that can be used in a diagram toolbar button script for links.
You can copy the script template text that follows from this topic to the Script property in Modeler. If you want single line spacing, copy the following text from this topic to Notepad, and then copy the text from Notepad to Modeler.
Key:
Remarked variable names at the top of the file are available in all functions underneath except where stated.
Remarked variable names immediately above functions are only available in those functions (or subfunctions called).
The comment line '---Context change--- indicates that script is unloaded and reloaded here between function calls - this means that script scoped variables cannot be used to transfer data between functions separated by one of these comment lines, and other methods (such as helper dlls) should be used in the (fairly rare) situation that this is needed.
Option Explicit

'Studio(.DisplayOutputWindowMessage and .ClearOutputWindow)
'Projects
'ActiveProject
'CurrentScript
'Diagram
'DroppedItem
'Script.AffectedItem
'Script.DisconnectedSymbol
'Script.DropEffect 0,1,2 or 4 depending on mouse cursor (see Help)
'Script.HitSymbol (Diagram for Diagram Canvas)
'Script.PasteAtX
'Script.PasteAtY

'Dictionary available here but *not* available in OnDrop()
Function ValidDrop()
ValidDrop=False'Do not run OnDrop() and abandon Drop
ValidDrop=True'Do run OnDrop()
End Function

'---Context change---

'DropResult - usually the symbol created (see help)
Function OnDrop()
OnDrop=False'Do not commit the transaction
OnDrop=True'Do commit the transaction
End Function