Tinderbox 7 Icon

OnAdd


Attribute Data Type: 

Attribute Default Value: 

Attribute Group: 

Attribute Purpose: 

Attribute Inherited from Preferences?   

Attribute Read-Only? 

Attribute Intrinsic? 

Attribute First Added: 

Attribute Altered: 

 action   [other action-type attributes]

 (not set - empty string)

 General   [other General Group attributes]

 Action code

 No

 No

 No

 Baseline

 


Action code expression executed when a note becomes child of the current note, be it new or moved there by dragging.

Adornments also offer 'OnAdd' action support. Although it takes a string argument, the string must be valid action syntax.

$OnAdd actions are applied to each item of a multiple-item drag, even if the dragged notes originate in a different file. The $OnAdd action is applied only once, when a note is created inside a container, or is moved into a container from some other container. This stops $OnAdd being re-applied for actions like moving an note on a Map and where $OnAdd may have iterative effects on a note if re-applied. Pasting a note into a container runs the $OnAdd action.

The container's $OnAdd action acts on both newly-made notes and agents.

For agents, $OnAdd is replaced by $AgentAction (though not in smart adornments)

Adornments show a slightly different behaviour. Here, the $OnAdd is re-triggered if a note is moved manually within the adornment - i.e. never leaves it - as the move effectively takes the note out of the adornment (start of move) and adds it back at the end of the move. However, if notes are moved automatically within an adornment due to adornment sorting, or by an external action altering $Xpos/$Ypos, the adornment's $OnAdd is not run again.