I take the last code chunk back. This does not work. :( customKeys[ myPropName ]
...Does not make a new property in the default customKeys set. I can't seem to make any new properties in the default set without setting it directly by name - which won't work if you want the name of the property to come from a variable. I even tried: set the customProperties[ "customKeys" ] of this stack to myCustomPropValueList WHICH YOU SHOULD NOT DO! This seems to totally screw up the property sets list. It seems you can only create variable-driven property names in sets other than the default... put "ABC" into myCustomPropNameVar put "123" into myCustomPropValue[ "x1" ] put "456" into myCustomPropValue[ "x2" ] set the mySet[ myCustomPropNameVar ] of this stack to myCustomPropValueList And then to get at your ABC property's array value: put the mySet[ myCustomPropNameVar ] of this stack into myCustomProp put myCustomProp[ "x1" ] into msg -- "123" So there may be something to post as a bug here... ~ Chris Innanen ~ Nonsanity On Wed, Apr 27, 2011 at 1:55 PM, Nonsanity <f...@nonsanity.com> wrote: > Remember that there is the customKeys set and if you do this: > > put "ABC" into myCustomPropNameVar > put "123" into myCustomPropValue > set the myNewPropSet[ myCustomPropNameVar ] of this stack to > myCustomPropValue > > You are creating a new key set. If you look at the Custom Properties page > of the inspector window, you won't see your "ABC" property in the list. > Under the list of properties is a pop-up menu called Set. If you look in > there you'll see "myNewPropSet" and if you select that, you'll see the ABC > custom property with the 123 value in it. > > If you want a property to be in the main set ("customKeys") AND you want > that property to be an array, you can't set the individual elements of the > area IN the set command. You have to modify a local array variable and then > set the property to that. > > In my example above, the value is just "123", but if you want that to be an > array, it would go like this: > > put "ABC" into myCustomPropNameVar > put "123" into myCustomPropValue[ "x1" ] > put "456" into myCustomPropValue[ "x2" ] > set the customKeys[ myCustomPropNameVar ] of this stack to > myCustomPropValue > > Not the use of the "customKeys" name. If you use array notation in the set > command for properties, you are messing with sets, not the contents of the > properties. > > ~ Chris Innanen > ~ Nonsanity > > > > On Wed, Apr 27, 2011 at 1:38 PM, Glen Bojsza <gboj...@gmail.com> wrote: > >> Hi Mark, >> >> The do script produces what I want (myscore should be score in the >> example) >> though I am still working through your array structure to see if I can get >> the same results... so far no luck. >> >> On Wed, Apr 27, 2011 at 11:23 AM, Mark Schonewille < >> m.schonewi...@economy-x-talk.com> wrote: >> >> > Hi Glen, >> > >> > One of the problems is that testname and testname[student] are different >> > variables. First it is a simple variable, but next it is an array. When >> you >> > turn testname into an array, the variable is cleared and as soon as it >> is >> > cleared testname is parsed as plane text and hence as a property name. >> > >> > You might use the "do" variable: >> > >> > put 10 into score >> > put "math" into myVarName >> > put "set the" && myVarName & "[" & quote & myStudent & quote & "] of >> this >> > stack to myScore" into myScript >> > do myScript >> > >> > But why would you do this? It is much easier to use a straightforward >> array >> > structure by writing the following... >> > >> > put the cStudentScores of me into myStudentScoresArray >> > put "math" into mySubject >> > put "John" into myStudent >> > put 10 into myScore >> > put myScore into myStudentScoresArray[mySubject][myStudent] >> > set the cStudentScores of me to myStudentScoresArray >> > >> > -- >> > Best regards, >> > >> > Mark Schonewille >> > >> > Economy-x-Talk Consulting and Software Engineering >> > Homepage: http://economy-x-talk.com >> > Twitter: http://twitter.com/xtalkprogrammer >> > KvK: 50277553 >> > >> > New: Download the Installer Maker Plugin 1.6 for LiveCode here >> > http://qery.us/ce >> > >> > On 27 apr 2011, at 18:27, Glen Bojsza wrote: >> > >> > > Hello, >> > > >> > > Hopefully someone is still looking at the list while the conference is >> > going >> > > on... >> > > >> > > I want to create a customkey from a variable. >> > > >> > > on mouseup >> > > put "Math" into testname >> > > set the testname[student] of this stack to score >> > > end mouseup >> > > >> > > this doesn't create the customkey or properties for me but if I don't >> use >> > a >> > > variable it will work? >> > > >> > > on mouseup >> > > set the Math[student] of this stack to score >> > > end mouseup >> > > >> > > I really would like to use a variable so I can automatically create >> the >> > > customkeys on the fly. >> > > >> > > Any suggestions? >> > > >> > > regards, >> > > >> > > Glen >> > > _______________________________________________ >> > > use-livecode mailing list >> > > use-livecode@lists.runrev.com >> > > Please visit this url to subscribe, unsubscribe and manage your >> > subscription preferences: >> > > http://lists.runrev.com/mailman/listinfo/use-livecode >> > >> > >> > _______________________________________________ >> > use-livecode mailing list >> > use-livecode@lists.runrev.com >> > Please visit this url to subscribe, unsubscribe and manage your >> > subscription preferences: >> > http://lists.runrev.com/mailman/listinfo/use-livecode >> > >> _______________________________________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> > > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode