Going MAD with customKeys!!!!!

MisterX b.xavier at internet.lu
Wed Nov 2 12:20:05 EST 2005


David,

I know dynamic scripting really well. As Eric showed, you can easily
generate your own globals.

Then again, do you really need to?

Let me explain with something im working on right now. A virtual-dynamic
global database - for the TAOO conscience...

if parray is an array and a global as well

You can also do this in rev:

put the props of control x into pArray
do anything to pArray[whatever]
set the props of control x to pArray

And now you magically have a newer custompropsets (Cpset Name = pArray,
[keys of parray] = custom props, each with their values.

You can delete the CPS before saving it back because if CPS don't work the
same as array keys (a pity). (to delete keys in a CPS, you have to delete
them in a list (in a variable) and set the cps of your whatever to the
variable - strange but it works...

And that does the trick, all your customkeys are set!
hope this helps - it sure saved me LOTs of time in HC and still does
today in keeping settings handy in a easy to use array structure...

> the cp_PrefsArray_NameA of Stack "CommonStack"
> the cp_PrefsArray_NameB of Stack "CommonStack"
> the cp_PrefsArray_NameC of Stack "CommonStack"

so put into plain english, you script translates simply to 
put whatever into thecp[PrefsArray,NameA]
...

set the cp of stack "commonstack" to thecp

and the venerable line

get the cp[this,orthat] of stack pstack

cheers
Xavier
http://monsieurx.com/taoo

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> David Burgun
> Sent: Wednesday, November 02, 2005 3:59 PM
> To: How to use Revolution
> Subject: Re: Going MAD with customKeys!!!!!
> 
> Hi Xavier,
> 
> The problem is that I have:
> 
> the cp_PrefsArray_NameA of Stack "CommonStack"
> the cp_PrefsArray_NameB of Stack "CommonStack"
> the cp_PrefsArray_NameC of Stack "CommonStack"
> etc. etc. etc.
> 
> (NameA, NameB, NameC can by anything the calling stack(s) 
> chose to name them)
> 
> But I don't know the names "cp_PrefsArray_NameA", 
> "cp_PrefsArray_NameB ", "cp_PrefsArray_NameC" in the script 
> of "CommonStack", so I can't do this:
> 
> set the cp_PrefsArray_NameA of stack "CommonStack" to empty
> 
> or
> 
> set customProperties["cp_PrefsArray_NameA") of stack 
> "CommonStack" to empty
> 
> If I do this:
> 
> put the customKeys of stack "CommonStack" into myKeys
> 
> then myKeys is empty, otherwise I could have got a list of the names.
> 
> IOW, all the arrays are created over a period of time while 
> the App is running as and when they are needed. There is no 
> way (at the
> moment) to know which array have been created. I just want to 
> kill them all!
> 
> Is there something I am misunerstanding here?
> 
> Thanks for your help and sorry if I am being dumb!
> All the Best
> Dave
> 
> >David,
> >
> >on mouseUp
> >   put 1 into test["a"]
> >put 2 into test["b"]
> >put 3 into test["c"]
> >delete local test["b"]
> >put the keys of test
> >end mouseUp
> >
> >delete local (or global) array[arraykey]
> >
> >or (the following which applies for custompropertysets but not arrays
> >
> >get the keys of the array of control 1
> >delete line 1 to 3 of it
> >set the keys of array of control 1 to it
> >
> >Language inconsistency? maybe...
> >
> >cheers
> >Xavier
> >
> >use-revolution-bounces at lists.runrev.com wrote on 02/11/2005 15:26:09:
> >
> >>  Hi,
> >>
> >>  Sorry I don't don't get it. I have a number of Arrays stored as:
> >>
> >>
> >>  "cp_PrefsArray_NAMEA"
> >>  "cp_PrefsArray_NAMEB"
> >>  "cp_PrefsArray_NAMEC"
> >>
> >>  But I don't know the names (NAMEA,NAMEB,NAMEC) in the 
> script. I just  
> >> want to empty them all and start again. I thought that setting  
> >> customKeys to empty should do this - according to the docs 
> anyway. Is  
> >> this correct? If not how can I do this?
> >>
> >>  Thanks a lot
> >>  Dave
> >>
> >>
> >>  >David,
> >>  >
> >>  >Before i went mad, i was already crazy ;)  >  >The best 
> trick i can 
> >> give you is this:
> >>  >
> >>  >put the myprops["keyname"] of mystack into x  >x is not an array.
> >>  >
> >>  >put the myprops of mystack into x
> >>  >
> >>  >x is an array...
> >>  >
> >>  >BUT, you cannot store an array into the myprops["keyname"] of 
> >> mystack  >  >only into the myprops of mystack  >  >simply 
> because Rev 
> >> can't [yet] embed arrays into arrays...
> >>  >
> >>  >hope that helps...
> >>  >
> >>  >I TRIED TO PASTE YOUR SCRIPT INTO mc BUT IT REFUSED TO GET THE 
> >> RIGHT  >CLIPBOARD  >despite trying from notes to ultraedit to mc 3 
> >> times and it didn't go
> >into
> >>  >mc...
> >>  >
> >>  >
> >>  >cheers
> >>  >Xavier
> >>  >
> >>  >use-revolution-bounces at lists.runrev.com wrote on 
> 02/11/2005 15:04:37:
> >>  >
> >>  >>  Hi All,
> >>  >>
> >>  >>  I have a stack that is used as a library stack. I use 
> it to hold
> >data
> >>  >>  for in arrays which are stored in Custom Properties.
> >>  >>
> >>  >>  I create the arrays like this:
> >>  >>
> >>  >>  put "XXX" into theName
> >>  >>
> >>  >>
> >>  >>  function SetArray(theName,theArray)  >>  put 
> "cp_PrefsArray_" & 
> >> theName" into myArrayName  >>  set the 
> customProperties[myArrayName] 
> >> of me to theArray  >>  end SetArray  >>  >>  function 
> >> GetArray(theName)  >  > put "cp_PrefsArray_" & theName" into 
> >> myArrayName  >  > put the customProperties[myArrayName] of me to 
> >> myArray  >>  return myArray  >>  end SetArray  >>  >>  Also in the 
> >> Stack Script:
> >>  >>
> >>  >>  on libraryStack
> >>  >>  local myArray
> >>  >>
> >>  >>  put "XXXX" into myArray("KeyX")
> >>  >>  get SetArray("Name",myArray)
> >>  >>  set the customKeys of me to empty  >>  put 
> GetArray("Name") into 
> >> myArray --Check if the above worked  >>  end libraryStack  >>  >>  
> >> But myArray is not "empty" it contains garbage from ages ago!
> >>  >>
> >>  >>  Can anyone please just tell me how to clear all the 
> >> customProperties  >>  in a stack?
> >>  >>
> >>  >>  Thanks a lot
> >>  >>  All the Best
> >>  >>  Dave
> >>  >>  _______________________________________________
> >>  >>  use-revolution mailing list
> >>  >>  use-revolution at lists.runrev.com
> >  > >>  Please visit this url to subscribe, unsubscribe and 
> manage your
> >>  >>  subscription preferences:
> >>  >>  http://lists.runrev.com/mailman/listinfo/use-revolution
> >>  >
> >>  >
> >>  >
> >>  >-----------------------------------------
> >>  >To make communications with Clearstream easier, Clearstream has  
> >> >recently changed the email address format to conform with 
> industry  
> >> >standards. The new format is 
> 'firstname.familyname at clearstream.com'.
> >>  >
> >>  >Visit us at http://www.clearstream.com  >  >IMPORTANT 
> MESSAGE  >  
> >> >Internet communications are not secure and therefore Clearstream  
> >> >International does not accept legal responsibility for 
> the contents 
> >> of  >this message.
> >>  >
> >>  >The information contained in this e-mail is confidential 
> and may be  
> >> >legally privileged. It is intended solely for the 
> addressee. If you 
> >> are  >not the intended recipient, any disclosure, copying, 
> >> distribution or  >any action taken or omitted to be taken 
> in reliance 
> >> on it, is  >prohibited and may be unlawful. Any views expressed in 
> >> this e-mail are  >those of the individual sender, except where the 
> >> sender specifically  >states them to be the views of Clearstream 
> >> International or of any of  >its affiliates or subsidiaries.
> >>  >
> >>  >END OF DISCLAIMER
> >>  >_______________________________________________
> >>  >use-revolution mailing list
> >>  >use-revolution at lists.runrev.com
> >>  >Please visit this url to subscribe, unsubscribe and manage your  
> >> >subscription preferences:
> >>  >http://lists.runrev.com/mailman/listinfo/use-revolution
> >>
> >>  _______________________________________________
> >>  use-revolution mailing list
> >>  use-revolution at lists.runrev.com
> >>  Please visit this url to subscribe, unsubscribe and manage your  
> >> subscription preferences:
> >>  http://lists.runrev.com/mailman/listinfo/use-revolution
> >_______________________________________________
> >use-revolution mailing list
> >use-revolution at lists.runrev.com
> >Please visit this url to subscribe, unsubscribe and manage your 
> >subscription preferences:
> >http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage 
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list