Setting the value of a button hilite in script

Pete pete at
Tue Dec 13 17:50:10 EST 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

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 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!

Molly's Revenge <>

More information about the Use-livecode mailing list