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:51 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 to delete just a selected set, for example if the parameter pSetName had the users name in and i wanted to delete that without touching the other sets.

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. Thanks michael.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Deleting Custom Property Sets

Post by Janschenkel » Thu Nov 26, 2009 11:59 am

I'm a little confused. Do you have a custom property set per user, or one custom property set, where each user has an element? In other words, do you want to delete the whole set, or an individual property in a set?

Getting rid of the whole set is quite easy:

Code: Select all

command DeleteCustomPropertySet pObject, pSet
   local tSets
   put the customPropertySets of pObject into tSets
   set the wholeMatches to true
   delete line lineOffset(pSet,tSets) of tSets
   set the customPropertySets of pObject to tSets
end DeleteCustomPropertySet
Getting rid of an individual element is not too complicated either:

Code: Select all

command DeleteCustomPropertyFromSet pObject, pSet, pProperty
   local tPropertiesA
   put the customProperties[pSet] of pObject into tPropertiesA
   delete variable tPropertiesA[pProperty]
   set the customProperties[pSet] of pObject to tPropertiesA
end DeleteCustomPropertyFromSet
HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

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 » Thu Nov 26, 2009 12:11 pm

The stack creates an individual property set, what i want is for the application to be able to delete an individual property set, like how revolution does in the Custom Properties part of the Inspector.

For example: Say there are three users logged on, Admin, User1 and User2. Under the CustomPropertySets property it will list Admin, User1 and User2. Now say for example that User1 clicks logoff, I want the application to delete the Custom Property Set without effecting the other two.

Im sorry i was in a rush to right the first message and paragraph so i apologize if it boggled you mind. Beleive me it boggled my mind when i re-read them. :oops:

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Deleting Custom Property Sets

Post by Janschenkel » Thu Nov 26, 2009 6:13 pm

It's quite alright - it happens to me all the time, sometimes I realize it mid-sentence and can correct it; at other times, I get confused looks and only then reliaze I have to do it all over again :-)
Anyway, I think my previous answer will help you get things sorted out.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply