Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Script functions, objects and attributes > Script templates > Script template for diagram toolbar button scripts for nodes
  
Script template for diagram toolbar button scripts for nodes
This topic provides a template of the empty functions that can be used in a diagram toolbar button script for nodes.
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
'Projects
'ActiveProject
'Dictionary (except for OnFinished)
'CurrentScript
'Diagram - the active diagram
'Script.Flags - Bits indicating mouse button, Shift and Ctrl keys pressed (except OnFinished). See Help
'Script.HitSymbol - the item that is clicked on the diagram. Nothing if the diagram background is clicked
'Script.AdditionalInfo - Only matters for Activity Partitions otherwise 0 (see Help)
'Script.PasteAtX - Absolute X posn mouse clicked
'Script.PasteAtY - Absolute Y posn mouse clicked

Function ValidInsertionPoint()
ValidInsertionPoint=False
ValidInsertionPoint=True
End Function

'---Context change---

'Override the right click dialog allowing the user to choose an existing dictionary item for the new symbol.
'(or decide they do want a new one after all and to provide a name for it)
'Leave commented or delete if you want the default functionality
Function SelectObject()
'SelectObject=False
'In a given invocation you should either
'Script.AddResultObject <DictItem>
'or
'Script.NewItemName = <namestring for new item>
'SelectObject=True
'End Function

'---Context change---
'Override the part/port dialog allowing the user to choose an existing "type" for a part or port
'or to create a new class for the type, or finally to leave it untyped.
'Leave commented or delete if you want the default functionality
'Function SelectType()
'SelectType=False
'In a given invocation you should either
'Script.AddResultObject <DictItem>
'or
'Script.NewItemName = <namestring for new item>
'SelectType=True
'End Function

'---Context change---

'NewSymbol - the symbol being added to the diagram if there is one
'DictItem - the dictionary item being added to a diagram if there is one
'Script.AddedSymbol - Only for Custom Node/Link scripts programmer must set
'Script.SelectedDictionaryItem - Only for Custom Node scripts gives oItem (if any)
' set by SelectObject() Script.AddResultObject(oItem) call
Function OnFinished()
OnFinished=False
OnFinished=True
End Function