Back to button basics
tereza at califex.com
Wed Dec 6 00:30:28 EST 2006
On Dec 5, 2006, at 9:05 PM, Jan Sælid wrote:
> What I want to do is to just change the icon according to the state of
> onstate property. Should I use a visited icon or a hilited icon? No
> what I turn off or on I seem to get some additional behaviour. Like
> a border
> or the traversal border. I’m sorry that I have to bother you with
> this but
> my early days of lessons is just hidden under layers of other
If all the buttons do is signal a state change that will be acted on
later, I would put the following script in the group:
set the hilite of the target to not (the hilite of the target)
I would set the hiliteIcon property to get my custom icon. I would
set the autohilite of the buttons to false, and just to make sure I
would set the hiliteborder and hilitefill of the buttons to false, too.
If I didn't want a focus border (and I never do), I would set the
showfocusborder of the buttons AND of the group to false (otherwise,
in Windows, the dotted line focus border shows up on the buttons
If I want rollover behavior, I would use the new hoverIcon property
instead of the autoArm and armedIcon property; so I'd set autoArm of
the buttons to false, and I would set the armBorder and armFill of
the buttons to false too, for good measure.
I'd set the traversalOn of the group and the buttons to true.
I'd avoid the visitedIcon unless you really have a "visited" state
you need to convey (i.e. this button has been clicked already but
it's not disabled--I guess it's a Unix thing.)
If I need to carry around the state of the buttons (assuming they
record states), I'd do something like:
repeat with N = 1 to the number of buttons of grp "states"
put the hilite of btn N of grp "states" into \
tStateArray[the short name of btn N of grp "states"]
...and then later:
if tStateArray["meaningfulButtonName"] then ....
If it's against your religion to conflate a gui state with a program
state, it's still easier and clearer when you avoid elaborate if
statements, just to transfer Boolean values; that is, use:
set the hilite of me to the onstate of me
if the onState of me is true then set the hilite of me to true
Califex Software, Inc.
Califex Software, Inc.
More information about the Use-livecode