Deleting Custom Properties

Richmond Mathewson richmondmathewson at gmail.com
Thu Jun 25 16:49:41 EDT 2009


I dunno, seems a bit complicated.

I just dug out a stack I made a while back that I popped together to try 
and understand customProps (which, oddly enough,
turned out to be extremely simple to understand).

Now on that stack, on its single card there is a button called "CusProp" 
which contains 2 customProperties which are
set up through another button with the following script:

on mouseUp
  set the porkNbeans of btn "CusProp" to 547
  set the custardTart of btn "CusProp" to "Silly Sausage"
  set the daftChap of btn "CusProp" to 96
end mouseUp

on opening the prefs palette the customProperties of the btn "CusProp" 
can be seen to have come into existence, and their
values filled in.

So, tried to delete them via another button with this script:

on mouseUp
  set the customPropertySets of btn "CusProp" to tArray
end mouseUp

which, oddly, only knocked out 'custardTart' . . . so tried this:

on mouseUp
  set the customPropertySets of btn "CusProp" to tArray
  set the customPropertySet of btn "CusProp" to qArray
end mouseUp

ALL GONE!

What I don't quite understand is why  'set the customPropertySets of btn 
"CusProp" to tArray' only removes
the first customProperty, and 'set the customPropertySet of btn 
"CusProp" to qArray' by itself removes
nothing at all.


Mark Smith wrote:
> Klaus, a slightly simpler way is to use the fact the "the 
> customproperties" of an object is an array, so:
>
> put the customproperties of btn "xyz" into tArray
> delete variable tArray["propname"]
> set the customproperties of btn "xyz" to tArray
>
> Randy, it's worth looking into customPropertySets - "the 
> customproperties" of an object is just the "current" customPopertySet 
> of that object.
>
> Best,
>
> Mark
>
>
> On 25 Jun 2009, at 19:47, Klaus on-rev wrote:
>
>> Hi Randy,
>>
>>> Hi All,
>>>
>>> I've been playing with custom properties over the past several weeks 
>>> for pretty much the first time.
>>> I've been able to create, fill, and empty them via script... 
>>> however, I've not been to delete one via script. How is that 
>>> accomplished?
>>
>> this is the most cumbersome thingie in the whole Rev universe :-D
>>
>> Fact is, you have to:
>> ...
>> put the customkeys of btn "xyz into cp_list
>> put lineoffset("propname_to_delete",cp_list) into line_nr
>> delete line line_nr of cp_list
>> set the customkeys of btn "xyz" to cp_list
>> ...
>>
>> BTW, has this ever bee bugzilla'd as an enhancement?
>>
>>> take care,
>>> randy hengst
>>
>> Best
>>
>> Klaus
>>
>> -- 
>> Klaus Major
>> http://www.major-k.de
>> klaus at major.on-rev.com
>>
>>
>




More information about the use-livecode mailing list