Looping over all buttons

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Feb 22 12:17:13 EST 2012


Hi Mark,

That would be:

repeat with x = 1 to the number of buttons of cd y
  put the hilite of btn x into myButtonArray[x]
end repeat

If you want to have the hilites as text, you might want to use a normal variable instead of an array: 

put the hilite of btn x & cr after myButtonList

Make sure to read everything about repeat loops in the LiveCode dictionary!

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Download the Installer Maker Plugin 1.7 for LiveCode here http://qery.us/za

On 22 feb 2012, at 17:49, 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
> 





More information about the use-livecode mailing list