Error getting tags :
error 404Error getting tags :
error 404 behavior | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle

set the behavior of childObject to behaviorObjectReference

Desktop, Web and Server
Platform Support
Mac OS X,Windows,Linux
None required
Specifies where an object used as a custom control should inherit its behavior from.

set the behavior of tNewGroup to the long id of button "Widget" of card "Behaviors"

Additional Comments
Expander triangle

Behaviors are a method to create common functionality between objects without duplicating the scripts.


The behavior property is a reference to a button containing the script to use. It is in the format of a long ID.

By default, the behavior of newly created objects is empty.


An object with a behavior set will act as though its script was set to the script of the behavior button. If multiple objects share the same behavior, each will have its own set of script local variables. Any references to me, the owner of me etc will resolve to the child object currently executing.

The button containing the behavior script can be located anywhere. In particular this allows for it be located in a password protected stack, allowing you to protect the script without need to protect the controls using it.

Behaviors are resolved by Revolution immediately after loading a stack file, the engine acts as though it is resolving a control reference of the form: button id <id> of stack <stack name> [ of stack <mainstack name>]. Thus the stackFiles property will be searched and stacks loaded into memory as appropriate.

The behavior property does not track changes to the name of the stack and/or substack - if the name of a stack containing behavior objects is changed, then all references to these behaviors will be broken. This apparent strictness is necessary to ensure that behaviors act consistently while Revolution is running.

Note that the synonym parentScript is probably going to be removed before the release of version 3.5, so it should not be used. Please see the Engine Change log in the Revolution folder for more information.

User Comments
Expander triangle
User thumbnail
Peter Haworth
Feb 14, 2011
Behaviors are not in the form of a long ID. In fact the IDE will remove the [of stack <mainstack name>] mentioned above if it is included in a behavior.