How do I get a list of all controls on a card?

Phil Davis davis.phil at comcast.net
Mon Apr 10 20:57:16 EDT 2006


Here's one way:

on mouseUp
   put controlList() into tMyList
   answer tMyList
end mouseUp


function controlList pTargetCard
   # 'pTargetCard' = optional; the long name of a card. If not
   #  supplied by caller, it is assumed to be the current card.

   if pTargetCard = empty then
     put the long name of this card into pTargetCard
   end if

   put empty into tList -- not technically necesary
   put (the number of controls of pTargetCard) into xMax
   repeat with x = 1 to xMax
     put (the name of control x of pTargetCard) & cr after tList
   end repeat
   delete last char of tList -- the trailing CR
   return tList
end controlList


In 'controlList' you could collect 'the name' of each control, or 'the 
short name' or 'the long name' depending on your purpose.

Hope this helps -
Phil Davis


Xavier Bourque wrote:
> Hi,
> 
> My stack lets the user add and remove text fields and rectangles on a  
> card.
> 
> I want to gather a list of all the text fields and rectangles when  the 
> user is done adding/deleting them.
> 
> How do I get a list of all the controls on a card?
> 
> Thanks.
> 
> -- Xavier Bourque
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 




More information about the use-livecode mailing list