Surprising little issue

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sun Nov 26 08:46:21 EST 2006


Hi Scott,

That's exactly the same problem :-)

on preOpenCard -- in the stack's script
   local tCurCheckBoxStatus
   -----
   if there is a btn "MyCheckBox" then
     put the uCurCheckBoxStatus of this card into tCurCheckBoxStatus
     if tCurCheckBoxStatus is a boolean then
       set the hilite of btn "MyCheckBox" to tCurCheckBoxStatus
     else set the hilite of btn "MyCheckBox" to true -- or false :-)
   end if
end preOpenCard

On the other hand:

on mouseUp -- check box script
   <Statements>
   set the uCurCheckBoxStatus of this card to the hilite of me
end mouseUp

--------------------------------------------

BUT you could prefer write a more "global" code:

on preOpenCard -- in the stack's script
   local tCurCheckBoxStatus
   -----
   repeat with i = 1 to the number of buttons
   switch the style of btn i
    case "Menu"
      set the menuHistory of btn i to the uCurStatus of btn i
      break
    case "CheckBox"
    case "RadioButton"
      set the hilite of btn i to the uCurStatus of btn i
      break
   case "scale" -- slider
   case "progress" -- progress bar
     set the thumbPosition of btn i to the uCurStatus of btn i
   end switch
  end preOpenCard

Etc.
And each value will be stored in a custom property stored in the  
control itself (not the card)

Actually custom properties are very convenient.
They did not exist in HC.
Then many users coming from this environment don't take them into  
consideration :-(
What a pity :-)

PS. To know the style of any Rev control just create a new stack with  
all kinds of objects and put in the card script: "on mouseUp; put the  
style of the target;end mouseUp ;-)

Best Regards from Paris,
Eric Chatonet

Le 26 nov. 06 à 14:26, Scott Kane a écrit :

> Eric kindly helped me with the issue of storing a list object in a  
> custom property and it works beautifully (this is a stack with  
> multiple cards with objects set a background groups).  I've been  
> trying to do something similar with checkboxes.  However I don't  
> seem to be able to get it to stick. Anyone care to share a simple  
> routine to store the checked status of a checkbox as a custom  
> property so that each car can have a boolen result that may be  
> different to another card in that stack?
>
> Thanks in advance.
>
> Scott

------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/





More information about the use-livecode mailing list