Setting the value of a button hilite in script

Bob Sneidar bobs at twft.com
Tue Dec 13 18:12:17 EST 2011


Hmmm... breakpoint in the loop and check that the control you think you are setting is actually a checkbox or radio button, then make sure the property is what you think it is. Also check for a carriage return in the property. That bit me in the butt recently. 

Bob


On Dec 13, 2011, at 2:50 PM, Pete wrote:

> 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>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list