How do I generate a list of objects used in a stack?

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
arombauts
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Tue Jul 07, 2009 6:56 am

How do I generate a list of objects used in a stack?

Post by arombauts » Wed Dec 09, 2009 11:21 am

Hello all!

I would like to get a list of objects used in a stack. What would be the script?...

Thanks in advance...
André Rombauts, Liège (Belgium).
Retired teacher ( French language, History, English language and Computer science).
LC 9.6.6 (Business / HTML5 edition), testing LC 10 DP1.
Mac OS 11.6.2 Big Sur, MacBook Pro 16" 2019 (and other computers...).

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: How do I generate a list of objects used in a stack?

Post by bn » Wed Dec 09, 2009 11:36 am

Hi arombauts,
look at control

Code: Select all

put the number of controls 

Code: Select all

put the name of control 1

Code: Select all

put the number of controls of card 1
regards
Bernd

arombauts
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Tue Jul 07, 2009 6:56 am

Re: How do I generate a list of objects used in a stack?

Post by arombauts » Wed Dec 09, 2009 4:09 pm

Thanks a lot!
André Rombauts, Liège (Belgium).
Retired teacher ( French language, History, English language and Computer science).
LC 9.6.6 (Business / HTML5 edition), testing LC 10 DP1.
Mac OS 11.6.2 Big Sur, MacBook Pro 16" 2019 (and other computers...).

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10324
Joined: Wed May 06, 2009 2:28 pm

Re: How do I generate a list of objects used in a stack?

Post by dunbarx » Wed Dec 09, 2009 6:31 pm

You can write something like:

Code: Select all

on mouseup
   repeat with y = 1 to the number of controls
      put the number of control y && the name of control y into line y of temp
   end repeat
   answer temp
end mouseup

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10324
Joined: Wed May 06, 2009 2:28 pm

Re: How do I generate a list of objects used in a stack?

Post by dunbarx » Wed Dec 09, 2009 6:32 pm

You can also download the "wizard" stack from revOnLine

arombauts
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Tue Jul 07, 2009 6:56 am

Re: How do I generate a list of objects used in a stack?

Post by arombauts » Wed Dec 09, 2009 7:33 pm

Thanks all. Very easy indeed, as everything in RunRev...

Code: Select all

   put "Crd" & tab & "Ctrl ID" & tab & "Type" & tab & "Name" & return into field Display
   repeat with crd = 1 to the number of cards of this stack
      repeat with ctrl = 1 to the number of controls of card crd
         set the itemdelimiter to " "
         put crd & tab & the ID of control ctrl & tab & item 1 of the name of control ctrl & tab & item 2 of the name of control ctrl & return after field D
      end repeat       
   end repeat
André Rombauts, Liège (Belgium).
Retired teacher ( French language, History, English language and Computer science).
LC 9.6.6 (Business / HTML5 edition), testing LC 10 DP1.
Mac OS 11.6.2 Big Sur, MacBook Pro 16" 2019 (and other computers...).

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: How do I generate a list of objects used in a stack?

Post by Mark » Wed Dec 09, 2009 9:15 pm

Hi arombauts,

You might also like these handlers.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: How do I generate a list of objects used in a stack?

Post by lohill » Thu Dec 10, 2009 12:08 am

Here is a correction to arombats code to make it run:

Code: Select all

on mouseUp
       put "Crd" & tab & "Ctrl ID" & tab & "Type" & tab & "Name" & return into field "Display"
   repeat with crd = 1 to the number of cards of this stack
      repeat with ctrl = 1 to the number of controls of card crd
         set the itemdelimiter to " "
         put crd & tab & the ID of control ctrl of card crd & tab & item 1 of the name of control ctrl of card crd & \
         tab & item 2 of the name of control ctrl of card crd & return after field "Display"
      end repeat       
   end repeat
end mouseUp   
It also works nicely if field "Display" is a table field rather than a regular field.

Just trying to learn.
Larry

Post Reply