Lists all controls of 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
xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Lists all controls of a card ?

Post by xApple » Sun Jan 14, 2007 2:54 pm

I've gone thru the whole dictonary of transcript terms searching for something that would simply list all the controls present on a given card... to no avail.. any simple way of doing this ?

Help greatly appriciated.

My dream:

Code: Select all

put the controls of card 1 into myObjects
repeat with x = 1 to the number of lines of my myObjects
set the someProp of (line x of myObjects) to someValue
end repeat

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: Lists all controls of a card ?

Post by marielle » Sun Jan 14, 2007 3:08 pm

May your wildest dreams come true ;-)

Code: Select all

repeat with x= 1 to (the number of controls of this card)
 put the long id of control x of this card into tCtlRef
 set the iAmAControlOfThisCard of tCltRef to true
 if word 1 of tCtlRef is "field" then set the fontsize of tCtlRef to 16
end repeat
(typed on the fly and untested... feel free to correct me)
Last edited by marielle on Sun Jan 14, 2007 3:30 pm, edited 1 time in total.

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Sun Jan 14, 2007 3:12 pm

nice, nice... using the numerical index of every object, of course !
This varies depending on the layer I recall...

Thanks a lot ! Have a nice sunday.

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

Post by Mark » Mon Jan 15, 2007 5:06 pm

I like using a property: put the objects of this card, put the objectIDs of this card.

getProp objects
repeat with x = 1 to number of controls of the target
put the name of control x of the target & return after myList
end repeat
sort myList
return myList
end objects

getProp objectIDs
repeat with x = 1 to number of controls of the target
put the id of control x of the target & return after myList
end repeat
sort myList
return myList
end objectIDs

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”