How to set initial appearance of all buttons on UI using behaviors
J. Landman Gay
jacque at hyperactivesw.com
Mon Mar 5 18:51:11 EST 2012
On 3/5/12 4:46 PM, Sivakatirswami wrote:
> I have studied out behaviors a bit, but can we use a behavior button as
> a kind of template for all the static props of other objects?
>
> e.g. you have twenty buttons on a GUI and you want to change the look
> and feel of them all at the same time.
>
> I know you can set the script of buttons 1,2,3,4 using button A as a
> behavior for each of them. but what about their default colors,
> transparency shape button mode (round rectangle or regular or rectangle)
> etc.
>
> ???
>
> perhaps behaviors is not the way to go for this...
You could do it with the "properties" property in conjunction with
behaviors. Make your behavior button look exactly the way you want, and
then loop through the other buttons and set their properties to the
properties of the behavior button.
One caveat: the rectangle and name will be changed too (since they're
both properties,) which you probably don't want. So you should remove
those entries from the array, along with any others you don't want to
change, before actually setting anything. The dictionary explains it.
The first time I did this I got disasterous results and had to revert
the stack. Now I always look at the values in the debugger before I
actually go ahead and set anything. It's easy to get all your buttons
named the same and piled up on top of each other, but once it's properly
edited and working, it's very fast and efficient.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list