Looping over all buttons

Bob Sneidar bobs at twft.com
Wed Feb 22 12:12:42 EST 2012


not for.

repeat with x = 1 to the number of buttons of this card
  do "put the hilite of button x into button" & x
  -- a better way
  put the short name of button x into ButtonHilitesA[x]["name"]
  put the hilite of button x into ButtonHilitesA[x]["state"]
end repeat

Now you have a numbered array of button names and states. 

Bob

On Feb 22, 2012, at 8:49 AM, Mark Smith wrote:

> Hi, I have 38 buttons on a form that I need to copy their hilite value to a
> temporary variable. Is it possible in LC to do something like
> 
> for x = 1 to the number of buttons on card y
>   put the hilite of btn"x" into tButtonx
> end
> 
> instead of writing out manually, 38 times:
> 
>   put the hilite of btn"fhHypertension" into tButton4
>   put the hilite of btn"fhDiabetes" into tButton5
> etc
> 
> Thanks
> 
> -- Mark
> 
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Looping-over-all-buttons-tp4410980p4410980.html
> Sent from the Revolution - User mailing list archive at Nabble.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