List all Custom Properties in a stack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
erikhans08
Posts: 87
Joined: Wed Mar 25, 2015 2:01 am

List all Custom Properties in a stack

Post by erikhans08 » Mon Apr 06, 2015 9:26 am

Did someone once write a handler to list all Custom Properties in a stack and its stack files, buttons, fields, etc.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6235
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: List all Custom Properties in a stack

Post by dunbarx » Mon Apr 06, 2015 2:41 pm

Hi.

There is a native property, "the customProperties", that does this.

Craig Newman

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6957
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: List all Custom Properties in a stack

Post by FourthWorld » Mon Apr 06, 2015 2:55 pm

@erikhans08: which property are you looking for?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6235
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: List all Custom Properties in a stack

Post by dunbarx » Mon Apr 06, 2015 5:10 pm

@Richard, he wants custom properties.

@ Erik. Are you able to write your own handler that lists all the custom properties for any or all controls in a stack file? If you can, then, as Richard implied, you could extract any particular one of interest. But without that list, there is no way of knowing what those properties are, since you made and named them at some time in the past.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6957
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: List all Custom Properties in a stack

Post by FourthWorld » Mon Apr 06, 2015 6:02 pm

Thank you, Craig, but I think his thread title made that clear; pardon the brevity of my question.

I asked because I used to spend a lot of time making all sorts of stack reporting tools which produced text listing of all sorts of stuff. But over time I realized I never actually used that output because it was disconnected from the objects they were reporting - to take any action meant I still had to find the object in question and edit it.

To find the best solution here will depend on what's truly needed, so it would be helpful to find out what will be done with the custom property once found.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

TerryL
Posts: 69
Joined: Sat Nov 23, 2013 8:57 pm

Re: List all Custom Properties in a stack

Post by TerryL » Mon Apr 06, 2015 8:13 pm

You could use the customKeys property, which returns a line list of all custom props for an object. Another simpler solution is to look in each object's properties inspector under custom properties if there are only a few objects in the stack. Terry

Code: Select all

local AllCustomProps
put the short name of this stack &cr& the customKeys of this stack &cr after AllCustomProps
repeat with i = 1 to number(cds in this stack)
  put the short name of cd i &cr& the customKeys of cd i after AllCustomProps
  repeat with j = 1 to number(btns in this cd)  --btns, flds, imgs, graphics...
    put the short name of btn j &cr& the customKeys of btn j &cr after AllCustomProps
  end repeat
  --...
end repeat
Beginner Lab (LiveCode tutorial) and StarterKit (my public stacks)
https://tlittle72.neocities.org/info.html#26Anchor

erikhans08
Posts: 87
Joined: Wed Mar 25, 2015 2:01 am

Re: List all Custom Properties in a stack

Post by erikhans08 » Tue Apr 07, 2015 9:26 am

'The customkeys of my mainstack returned all of my custom properties, exactly as in the Stack Property Inspector.
My custom properties are all in my mainstack and I set them within a handler called from Message Box when I first open the mainstack.
The names of the custom properties are all preceded by a "u", as in uHeight, following The Gaskin Guidelines.
These 2 also show up although not declared by me:
Selection Description = false
revstack = false

So I can get all of my custom properties from Stack Property Inspector or Message Box.
I just like to be able to see them all at once.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”