Page 1 of 1

Using Behaviours

Posted: Tue Aug 18, 2009 5:22 pm
by phaworth
I'm setting up a library of reusable objects for my app by using custom behaviours but it seems that not all objects can have a custom behaviour. For example, I don't see a custom behaviour in the property inspector for an option menu button.

Is there a way around this for option menu buttons or any other objects that don't have a custom behaviour button in their property inspector?

Thanks,
Pete

Posted: Tue Aug 18, 2009 5:38 pm
by BvG
Like all rev uhm.. properties, the behaviour is a property.

so all you'd need to do is to set the "behaviour" property of your option button per script. See the relevant dictionary entry about the behaviour property for examples and more information on the correct usage.

Posted: Tue Aug 18, 2009 5:40 pm
by Klaus
Hi Pete,

you can assign a behaviour to ANY object, also if the IDE does not supply this button ;-)

Use the message box or a (temporary) button:
...
set the behavior of btn "your option button here" to the long ID of btn "the behvior button" of cd X of stack Y
...
In case you did not know:
There is only ONE object type "button".
An "option menu" button is just an ordinary button with its "style" property set to "menu" and its "menumode" property set to "option" :-)

Same applies to fields!
There is only ONE object type "field", all the variations come from the different properties.



Best

Klaus

Posted: Tue Aug 18, 2009 5:55 pm
by phaworth
Thanks Klaus. Yes I did know that option menus are variations of buttons.

Glad to hear custom behaviours can be set on any object but wonder why the ability to do that was left out of the property inspector.

Pete