Custom properties?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
I was wrong... This does work:
set the pTestX["1"] of this stack to "hi"
so... put max(the pTest["1"] of this stack) should also work. Thanks!
set the pTestX["1"] of this stack to "hi"
so... put max(the pTest["1"] of this stack) should also work. Thanks!
Re: Custom properties?
Greg.
Sure. Anything that can go into a variable can go into a custom property. Like arrays or images.
Craig
Sure. Anything that can go into a variable can go into a custom property. Like arrays or images.
Craig
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
but.. how would I convert this particular reference to a global?
put item 1 of myline & "," & item 5 of myline & return after SQarray[ALLname]
With SQarray being the global
Because, with properties, you must "set", can't "put after" ?
set the SQarrayProp[ALLname] of this stack to AFTER item 1 of myline ??
put item 1 of myline & "," & item 5 of myline & return after SQarray[ALLname]
With SQarray being the global
Because, with properties, you must "set", can't "put after" ?
set the SQarrayProp[ALLname] of this stack to AFTER item 1 of myline ??
Re: Custom properties?
Hi.
Just takes a second to get used to the different syntax.
More words than putting data into or after a variable, but nonetheless a simple and straightforward construction.
But remember the original issue. A custom property is a global repository of data, accessible from anywhere within LC, but local to the stack it lives in. If you clone a stack with a custom property from stack "A" to stack"B", that property will be copied over. But then you can modify the contents of each independently.
Globals are common to all stacks in the current session. Change it, and it changes everywhere.
I am saying that the extra words are a non-issue compared with the perfect functionality offered.
Craig
Just takes a second to get used to the different syntax.
Code: Select all
set the XYZ of this stack to the XYZ of this stack & return & someNewData --appends a new line (after?) to the property
But remember the original issue. A custom property is a global repository of data, accessible from anywhere within LC, but local to the stack it lives in. If you clone a stack with a custom property from stack "A" to stack"B", that property will be copied over. But then you can modify the contents of each independently.
Globals are common to all stacks in the current session. Change it, and it changes everywhere.
I am saying that the extra words are a non-issue compared with the perfect functionality offered.
Craig
Re: Custom properties?
Hi Greg,
But using NUMBERS as NAMES (be it for keys or objects) is not a good idea in Livecode!
Best
Klaus
this will create a custom property SET named "pTest" with a key named "1" with content "hi" in your stackadventuresofgreg wrote:...
set the pTestX["1"] of this stack to "hi"
...

But using NUMBERS as NAMES (be it for keys or objects) is not a good idea in Livecode!
Best
Klaus
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
Thanks a lot Craig. I'll make these changes and run some timed tests and I'll report back. Currently, it seems like there is some kind of cache in the LC engine where it will take some time to load the custom property into the local variable the first time it is called. After that initial load, it runs faster.dunbarx wrote:Hi.
Just takes a second to get used to the different syntax.
More words than putting data into or after a variable, but nonetheless a simple and straightforward construction.Code: Select all
set the XYZ of this stack to the XYZ of this stack & return & someNewData --appends a new line (after?) to the property
But remember the original issue. A custom property is a global repository of data, accessible from anywhere within LC, but local to the stack it lives in. If you clone a stack with a custom property from stack "A" to stack"B", that property will be copied over. But then you can modify the contents of each independently.
Globals are common to all stacks in the current session. Change it, and it changes everywhere.
I am saying that the extra words are a non-issue compared with the perfect functionality offered.
Craig
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
so clipartguy, just out of curiosity, how are you the "clipartguy" ?ClipArtGuy wrote:this should give your copy stack a custom property called "UniqueDataArray" which should contain your arrayCode: Select all
clone stack "Greg" set the UniqueDataArray of stack "Greg copy" to DataArray

-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
hmm... still having some problems avoiding dumping that custom property into a variable. Can you think of a way to do this with the property rather than a variable?
I could dump the pMetricsArray of this stack into a VAR, then split the var into an array, or repeat for each line myline as per example, but then I would have to stick it back into the custom property thereby defeating the purpose of reducing these costly data moves.
Code: Select all
repeat for each line myline in MetricsArray[Sname]
end repeat
Re: Custom properties?
An array does not have "lines". Try it. in a button
Step through the handler. You can see the array in the debugger, but that is because LC likes you. What do you know, there are no lines in the array at all. If you had you would get empty.
Normal LC processes required normal LC variables. You can use arrays all you like, but you cannot manipulate them them with "in the clear" means. You need either array methods, or use the "combine" command to get them into ordinary variable form.
Craig
Code: Select all
on mouseUp
repeat with y = 1 to 4
put y into MetricsArray[y]
end repeat
breakpoint
repeat for each line myline in MetricsArray[Sname]
put sname
end repeat
end mouseUp
Code: Select all
answer MetricsArray[Sname]
Normal LC processes required normal LC variables. You can use arrays all you like, but you cannot manipulate them them with "in the clear" means. You need either array methods, or use the "combine" command to get them into ordinary variable form.
Craig
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
My arrays have lines
Re: Custom properties?
Well, not really, and in any case they are not accessible in the clear. Did you try my handler above? Arrays are associations of keys and elements. They have no "ordinary" structure, like lines delimited by returns.My arrays have lines
Craig
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
Arrays with lines:
Code: Select all
Repeat for each key mykey in MyArray
Repeat for each line myline in MyArray[MyKey]
Repeat for each item myitem in myline
End repeat
End repeat
End repeat
Re: Custom properties?
Hey, the CONTENT of array keys does not count! 

-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom properties?
I'm concerned with speed. When the user moves the sliders, the graphs and metrics are updated in real time. So, there is a lot of sorting through many very large arrays that are retrieved from a SQL DB. I wrote my own graphing functions also (no ChartsEngine).
Re: Custom properties?
Your app looks very professional.
So without getting into a discussion that likely is just about terminology and semantics, your code snippet deconstructs the array via its keys, as Klaus alluded to. The "combine" command deconstructs an array as well, bringing it into the clear, as I like to say.
I only care that you understand that if you make an array, and then do something like:
That you do not think anything is amiss when you get empty as a result.
Craig
So without getting into a discussion that likely is just about terminology and semantics, your code snippet deconstructs the array via its keys, as Klaus alluded to. The "combine" command deconstructs an array as well, bringing it into the clear, as I like to say.
I only care that you understand that if you make an array, and then do something like:
Code: Select all
answer yourArray
Craig