Setting the value of a button hilite in script

Pete pete at mollysrevenge.com
Tue Dec 13 16:50:10 CST 2011


I wrote myself a script to set the initial values of controls on a card in
preOpenCard.  It looks for a custom property name cInitialValue, then
initialises the control to the value of the custom property, depending on
that type of control (field, button, etc).

I set the value of cInitialValue for checkboxes or radio buttons to either
true or false. My code then is:

set the hilite of control x of this card to (the cInitialValue of control x
of this card)

At run time, I get an error  - value is not a boolean (true or false) near
"false"

I'm suspecting this is because true and false are reserved words but the
set statement is treating them as literals (they are not in quotes in the
cprop though).  However, the statement:

put  (the cInitialValue of control x of this card) into control x of this
card

...works just fine when the value of the cprop is the word empty, also a
reserved word.

I'm reduced to what looks like a nonsenical if statement that checks the
cprop for true or false and sets the hilite of the button to true or false.
 Looks really weird!

-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>


More information about the use-livecode mailing list