Prototypes

Tinderbox Icon

Prototypes are a method to let a single note specify the default value for an entire class of notes. This is achieved by specifying an existing note as the prototype, via the IsPrototype attribute; this tells Tinderbox to use the prototype's values for the all the notes set to use that prototype.

Whenever Tinderbox uses a prototype it will use the value from the prototype for its own attributes unless the attribute is specifically set for that note (by action or manual edit). Such manual edits break inheritance (for that attribute only) but inheritance can be reset.

When you change an attribute in a prototype, you change it for the notes that use that prototype. A note inherits all attributes from its prototype except Created, Modified, Height, Width, XPos, and YPos. It also inherits various layout features and prototypes text if any. Prototypes aren't a necessary feature for everyday use but they can powerful time-savers for complex projects.

An existing agent may have IsPrototype set to true, but in either case any notes set to use that prototype do not themselves become agents.

While most attributes are inherited from prototypes, a few attributes are intrinsic - they apply to specific notes and are not inherited. For example, Xpos and Ypos are not inherited (because moving a prototype should not move notes that happen to use the prototype!).

Width and Height are not inherited. If they were, then resizing a prototype might in turn resize notes that inherit from that prototype -- perhaps covering other notes or disrupting a complex map. Newly-created notes take their initial Height and Width from their prototype.

If a note or agent is copied and pasted, the new item does not inherit its source's Prototype value. This is a defensive assumption by Tinderbox as it can't be sure pasted notes are from the current TBX and thus that all source prototypes exist. When creating 'template' type notes/containers bear this in mind. Think about using an agent to helps sets Prototype values directly or indirectly via rules and actions. Use if the |= operator can be used to ensure actions occur once only.

Duplicated notes retain the source note's Prototype. For notes that are prototypes themselves, if Note A is a prototype for note B, then duplicating A makes a new note but the duplicate no longer has a prototype link to B. The duplicate does have copies of other outbound links for A, but prototype links are no longer duplicated.

Prototypes can have children that are created/added to a note if that prototype is applied. Note: prototype children are not copied recursively. When setting the prototype for a note that already exists, Tinderbox will add new children if the prototype has children, but Tinderbox will not delete any child notes that already exists. If the cloned note would have the same name as an existing child, the existing child will be unchanged and the prototype child will not be cloned.

As it may be that you want a note that has children to be a prototype - but without its children being inherited - there is an attribute (PrototypeBequeathesChildren) to control this aspect of inheritance.

It is possible to designate some prototypes as 'private', meaning it doesn't appear in the selector lists available in Map & Outline view. Private prototypes can only be applied via code or via the prototype pop-up list on the note name/rename dialog.

In v4.7.0 it became possible for an adornment to be (selectable) as a prototype.


Up: Objects & Concepts
Previous: Rules  Next: Macros 

[Last updated: 14 Dec 2009, using v5.0]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox