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: FourthWorld, heatherlaine, Klaus, kevinmiller

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

Re: List all Custom Properties in a stack

Post by dunbarx » Sat Jul 30, 2022 8:24 pm

One might characterize the way the SE breaks out an array variable as a primitive "tree". Anyone who never has, try it. Make an array in a short handler, preferably of multiple levels and set a breakpoint right away. See how the SE (has always) done this.

I have used the SE in the past as a tool to examine array variables, as opposed to using the "combine" command and load the results into, say, a field. The difference is that a field is a far more permanent container.

Craig

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

Re: List all Custom Properties in a stack

Post by FourthWorld » Sat Jul 30, 2022 8:49 pm

dunbarx wrote:
Sat Jul 30, 2022 8:24 pm
I have used the SE in the past as a tool to examine array variables, as opposed to using the "combine" command and load the results into, say, a field. The difference is that a field is a far more permanent container.
How is the field more permanent than the tree widget?

In either case you drop them on a card, populate them with data, and if you save the stack the data stored in the objects within it remains.

What am I missing?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: List all Custom Properties in a stack

Post by dunbarx » Sat Jul 30, 2022 11:41 pm

Richard.

I was not comparing a field to the widget, rather a field to the display in the variable pane in the SE in debug mode:
I have used the SE in the past as a tool to examine array variables, as opposed to using the "combine" command and load the results into, say, a field.
Craig

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 138
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: List all Custom Properties in a stack

Post by bobcole » Sun Jul 31, 2022 1:59 am

Here is the same example from earlier (see above) but I added two Tree View widgets to display my two custom property sets.
All of the code is in the one button. Easy.
FYI,
Bob
CustomPropertiesExampleTreeView.livecode.zip
(2.04 KiB) Downloaded 99 times

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: List all Custom Properties in a stack

Post by marksmithhfx » Wed Aug 03, 2022 12:46 pm

dunbarx wrote:
Sat Jul 30, 2022 8:24 pm
I have used the SE in the past as a tool to examine array variables, as opposed to using the "combine" command and load the results into, say, a field. The
Craig
I have done that as well.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: List all Custom Properties in a stack

Post by marksmithhfx » Wed Aug 03, 2022 1:32 pm

Here's an example that compares the tree view widget to the displayArrayData(pArray, pIndent) function. Very different approaches to displaying array data but both have their uses. Data is from from this lesson https://lessons.livecode.com/m/4071/l/2 ... dable-form

Mark
Attachments
Try It.livecode.zip
(2.07 KiB) Downloaded 88 times
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 138
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: List all Custom Properties in a stack

Post by bobcole » Wed Aug 03, 2022 5:14 pm

Mark:
Nice comparison of the two approaches.
Thanks,
Bob

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

Re: List all Custom Properties in a stack

Post by FourthWorld » Wed Aug 03, 2022 7:10 pm

dunbarx wrote:
Sat Jul 30, 2022 11:41 pm
Richard.

I was not comparing a field to the widget, rather a field to the display in the variable pane in the SE in debug mode:
I have used the SE in the past as a tool to examine array variables, as opposed to using the "combine" command and load the results into, say, a field.
Craig
Does the Script Editor list object properties?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: List all Custom Properties in a stack

Post by dunbarx » Wed Aug 03, 2022 7:33 pm

Richard.

Hmmm.

If you:

Code: Select all

put the customProperties of this stack into temp
breakpoint
You can see that the SE shows the array variable "temp", open for inspection in a sort of "tree" view. It does not matter how many layers deep each one is, all are available.

The only other way to do this is to take the array variable 'temp" and apply the "combine" command to change it into an "ordinary" variable, which one might then load into a field and examine it.

I am sure we are not communicating well...

Craig

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: List all Custom Properties in a stack

Post by marksmithhfx » Wed Aug 03, 2022 10:16 pm

dunbarx wrote:
Wed Aug 03, 2022 7:33 pm

Code: Select all

put the customProperties of this stack into temp
breakpoint
Craig

Wow, how have a I lived so long without knowing about that command???

Thank you.
M
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 138
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: List all Custom Properties in a stack

Post by bobcole » Thu Aug 04, 2022 3:01 am

put the customProperties of this stack into temp
This command will retrieve the full array of data, at all levels, in the current (default) "customKeys" Set.

If you have created other Sets of custom properties outside of the customKeys Set, they will not be displayed.
According to the dictionary, to identify other Sets, if any, try this:

Code: Select all

get the customPropertySets of this stack --or other object
breakpoint
and look at the it variable in the Script Editor. Other custom Sets, like cREVGeneral, will be displayed but the default customKeys Set will not be listed.

I'm going to consider making my custom property sets as sub-sets of the default "customKeys" Set.
That way, the command at the top of this reply will give me everything at once.
Interesting discussion; further research...
Thanks,
Bob

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

Re: List all Custom Properties in a stack

Post by dunbarx » Thu Aug 04, 2022 4:18 am

Mark.
how have a I lived so long without knowing about that command???
Do you mean the "combine" command? The code snippet you posted did not mention that.

Anyway, if so, worth playing with, and be sure to fool around with the delimiters, as they are very helpful in "seeing" what is going on in the resultant display.

And further, assuming it really was the combine command, know that the "opposite" of that is the "split" command.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7266
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: List all Custom Properties in a stack

Post by jacque » Thu Aug 04, 2022 5:51 pm

Other custom Sets, like cREVGeneral, will be displayed but the default customKeys Set will not be listed.
This is due to historical reasons. Back in ancient times there were no custom property sets, we only had one default set. It had no name, and still doesn't, which is why to use it you set the customPropertySet to empty.

To list all the sets you can get the empty one and concatenate it with the others.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: List all Custom Properties in a stack

Post by dunbarx » Thu Aug 04, 2022 9:09 pm

I think it a minimum of civility to, at last, give it a name.

I mean, cummon, team.

Craig

Cairoo
Posts: 107
Joined: Wed Dec 05, 2012 5:54 pm

Re: List all Custom Properties in a stack

Post by Cairoo » Fri Aug 05, 2022 12:49 pm

dunbarx wrote:
Thu Aug 04, 2022 9:09 pm
I think it a minimum of civility to, at last, give it a name.

I mean, cummon, team.

Craig
No, please team, don't listen to Craig. It would break my apps. :P

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”