Page 1 of 1

order of customproperties

Posted: Mon Feb 07, 2011 7:31 pm
by jmburnod
Hi All,
I watch the customproperties are sorted by alphabetic order automaticaly
It is possible to keep the order by entry ?

Best

Jean-Marc

Re: order of customproperties

Posted: Mon Feb 07, 2011 10:10 pm
by dunbarx
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

Re: order of customproperties

Posted: Mon Feb 07, 2011 10:40 pm
by jmburnod
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)

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
Some news in a next post
Jean-Marc

Re: order of customproperties

Posted: Wed Feb 09, 2011 10:51 am
by jmburnod
Hi All,

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
Best

Jean-Marc

Re: order of customproperties

Posted: Wed Feb 09, 2011 12:59 pm
by Klaus
Bonjour Jean-Marc,
jmburnod wrote:...The "do" command is not necessary (a surprise for me)...
Yes, you can use a variable if it resolves into a valid name of a custom property!

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

Posted: Wed Feb 09, 2011 4:58 pm
by jmburnod
Salut Klaus
Yes, you can use a variable if it resolves into a valid name of a custom property!
Vielen Dank für diese Genauigkeit
Bis bald
Jean-marc