This version is out of date, covering development from v8.0.0 to v8.x.x. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v8 Icon

OnAdd


Attribute Data Type: 

Attribute Default Value: 

Attribute Group: 

Attribute Purpose: 

Attribute Inherited from Preferences?   

Attribute UI-configurable? 

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

 Yes

 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 a 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.

$OnAdd (or $AgentAction for agents) for the current note can be set via the Action Inspector → Action tab, code input box.