Deleting Custom Property Sets

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Deleting Custom Property Sets

Post by SirWobbyTheFirst » Wed Nov 25, 2009 4:52 pm

I have a stack which uses Custom Property Sets to keep track of the users data whilst they are logged onto the application. It creates custom property sets often (And quickly i may add.) and i was wondering if there was a way to delete just a selected set, for example if the parameter pSetName had the users name in and i wanted to delete the set which matched that set without touching the other sets in the stack.

How would i go about doing this? I know setting the custom property sets value for the stack deletes them all but i dont want to do this. Any help would be much appreciated. Thanks Michael.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Deleting Custom Property Sets

Post by Mark » Sat Nov 28, 2009 10:42 am

Dear Michael,

To delete custompropertyset setX, use the following code:

Code: Select all

on mouseUp
     put the custompropertysets of this stack into mySets
     filter mySets without "setX"
     set the custompropertysets of this stack to mySets
end mouseUp
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Re: Deleting Custom Property Sets

Post by SirWobbyTheFirst » Sat Nov 28, 2009 12:36 pm

Thank You Mark, your starting to become a visionary to me. I'd been experimenting across Thursday and Friday and the code I came up with used a hidden field but the example you've shown will enable me to get rid of the field and shorten down the script. So thank you very much. This was my original code, which did work but I'm kinda like a perfectionist and that I always like to minimise the code size.

Code: Select all

Function DeleteCustomPropertySet pStack,pSetName
Put The CustomPropertySets Of Stack pStack Into Field "Property Sets"
Find pSetName In Field "Property Sets"
Delete The FoundLine
Set The CustomPropertySets Of Stack pStack To Field "Property Sets"
End DeleteCustomPropertySet
Thanks, Michael.

Post Reply