Processing all the graphics on a card

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

Processing all the graphics on a card

Post by AlexAdams » Mon Jan 26, 2009 8:49 pm

I need to loop through all the graphics on a card. Evaluating properties and customer properties and setting properties and custom properties. How do I loop through all the graphics?

Thanks,
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Mon Jan 26, 2009 9:29 pm

Objects can be referred to by their ordinal number (e.g., "control 1" for any object on the card, or "graphic 1" for just objects of that type).

The "repeat" control structure has a form which lets you increment a counter variable (e.g., "repeat with i = 1 to 10").

The number of objects of a given type can be determined by simply asking:
"get the number of graphics".

So putting these ingredients together we get this recipe:

Code: Select all

repeat with i = 1 to the number of grcs
   put the customProperties of grc i into tMyPropsArray
   -- do something with those
end repeat
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

AlexAdams
Posts: 38
Joined: Sat Jan 17, 2009 8:49 pm
Contact:

Post by AlexAdams » Mon Jan 26, 2009 11:29 pm

Thanks Richard. That sounds like exactly what I need.
Alex Adams
(a)2 Technology Parnters
alex@a2technology.com
www.a2technology.com
www.promisstudio.com
831-726-8013

Post Reply