revUp - Updates and news for the LiveCode community
Issue 143 | November 9th 2012 Contact the Editor | How to Contribute

How to Assign a Behavior
By Trevor DeVore

This lesson will show you how to assign the behavior property of a control in LiveCode.

What is a Behavior?

A behavior is merely the script of a button (1) that can be assigned to other controls (2). Any control that has it's behavior property assigned to the button will inherit the script of the button as its own.

Assigning a Behavior

You assign a button as the behavior of another control by setting the control's behavior property to the long id of the button (1). Now any changes you make to the script of the button will alter how the control behaves since you are essentially changing the script assigned to the control.

For example, if the button (2) has an openField handler defined in it's script then when openField is sent to the field (3) that code would be executed.

About the Author

Trevor DeVore is a partner in Blue Mango Learning Systems, creator of Screensteps and Clarify, and long time LiveCode user.

 

Main Menu

What's New


Buy Beginners LiveCode Book