order of customproperties
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
order of customproperties
Hi All,
I watch the customproperties are sorted by alphabetic order automaticaly
It is possible to keep the order by entry ?
Best
Jean-Marc
I watch the customproperties are sorted by alphabetic order automaticaly
It is possible to keep the order by entry ?
Best
Jean-Marc
https://alternatic.ch
Re: order of customproperties
Hi.
The property inspector lists them as the are created. But the customProperties is stored as an array, and I believe it is not managable the way you want it unless you combine the array data back into a normal variable, and work from there.
Of course, you could always add a marker to a custom property as you create them, as in "myCustprop 1", "myCustProp 2", etc. and deconstruct the array that way. It would be easy to use another custom property that kept track of all custom properties you created, so that even if you deleted some the index value would still be maintained. So if you first set the custPropCounter to 0, you can then write:
on mouseUp --this is in the object script
repeat 3
set the custPropCounter of me to the custPropCounter of me + 1
put "myCustProp" && the custPropCounter of me into temp
set the temp of me to random(999) --your values here, this is just to see how they build...
end repeat
end mouseUp
The list in the property inspector is ordered. Try this two or three times and you will see the properties listed as the build. But now you can also get the customProperties array itself, combine it however you want to, and sort by the last word of each.
Craig Newman
The property inspector lists them as the are created. But the customProperties is stored as an array, and I believe it is not managable the way you want it unless you combine the array data back into a normal variable, and work from there.
Of course, you could always add a marker to a custom property as you create them, as in "myCustprop 1", "myCustProp 2", etc. and deconstruct the array that way. It would be easy to use another custom property that kept track of all custom properties you created, so that even if you deleted some the index value would still be maintained. So if you first set the custPropCounter to 0, you can then write:
on mouseUp --this is in the object script
repeat 3
set the custPropCounter of me to the custPropCounter of me + 1
put "myCustProp" && the custPropCounter of me into temp
set the temp of me to random(999) --your values here, this is just to see how they build...
end repeat
end mouseUp
The list in the property inspector is ordered. Try this two or three times and you will see the properties listed as the build. But now you can also get the customProperties array itself, combine it however you want to, and sort by the last word of each.
Craig Newman
Re: order of customproperties
Hi Craig,
Thank for your reply.
I need (for lisibility) to keep signifiant words for customproperties and i want have an order without integer.
I will test this way :
I keep the actual name and i create a new customprop it contains the name of the customprop in the order i defined
Something like that (no tested)
Some news in a next post
Jean-Marc
Thank for your reply.
I need (for lisibility) to keep signifiant words for customproperties and i want have an order without integer.
I will test this way :
I keep the actual name and i create a new customprop it contains the name of the customprop in the order i defined
Something like that (no tested)
Code: Select all
function GetPropInMyOrder
put empty into GetPropInMyOrder
put the MyListProp of this stack into tPropStack
repeat for each line tProp in tPropStack
do "put the tProp of this stack &return after rGetPropInMyOrder"
end repeat
delete last char of rGetPropInMyOrder
return rGetPropInMyOrder
end GetPropInMyOrder
Jean-Marc
https://alternatic.ch
Re: order of customproperties
Hi All,
This script work. The "do" command is not necessary (a surprise for me)
Best
Jean-Marc
This script work. The "do" command is not necessary (a surprise for me)
Code: Select all
function LesPropUnGrp pLeGroup
put empty into rLesPropUnGrp
put the MyPropOrder of group pLeGroup into bufProp --•• one line by prop
repeat for each line UneLi in bufProp
put the Uneli of group pLeGroup into ContProp
put UneLi&&ContProp&"," after rLesPropUnGrp
end repeat
delete last char of rLesPropUnGrp
return rLesPropUnGrp --•• a list of items of two words "nameProp contProp"
end LesPropUnGrp
Jean-Marc
https://alternatic.ch
Re: order of customproperties
Bonjour Jean-Marc,
Works:
...
put ("cMyCP" & 1) into tPropName
answer the tPropname of this stack
...
Does not work:
...
answer the ("cMyCP" & 1) of this stack
...
Best
Klaus
Yes, you can use a variable if it resolves into a valid name of a custom property!jmburnod wrote:...The "do" command is not necessary (a surprise for me)...
Works:
...
put ("cMyCP" & 1) into tPropName
answer the tPropname of this stack
...
Does not work:
...
answer the ("cMyCP" & 1) of this stack
...
Best
Klaus
Re: order of customproperties
Salut Klaus
Bis bald
Jean-marc
Vielen Dank für diese GenauigkeitYes, you can use a variable if it resolves into a valid name of a custom property!
Bis bald
Jean-marc
https://alternatic.ch