Initializing variables
Jan Decroos
jan.decroos at groepvanroey.be
Mon Mar 11 05:10:01 EST 2002
Maybe this can help:
we use next handler to initailize variables :
PutInto youValue,"destinationKinds","destinationNames"
with
destinationKinds : comma separated list of destination kinds
"g" : global,
"c" : card field,
"b" or "f" background field,
"c" : card field
empty items : repeat previous one
destinationNames : comma separated list of of short names
of the destinations
example :
PutInto empty,"g,c,,b","gName1,cfield1,cfield2,bfield1" equals to
put empty into gName1 -- gName1 = globalName
put empty into card field "cfield1"
put empty into card field "cfield2"
put empty into bg field "bfield1"
PutInto 5,"b","bfield1,bfield2,bfield3,bfield4,bfield5,bfield6" equals to
put 5 into field "bfield1"
put 5 into field "bfield2"
put 5 into field "bfield3"
put 5 into field "bfield4"
put 5 into field "bfield5"
put 5 into field "bfield6"
here's the handler (in DEV, so AS IS...) :
(store it in your stack script, or in the stack script of a 'stackinuse')
**************
on PutInto pValue, pKinds, pNames
put the HCAddressing of this stack into lHCAddr
set the HCAddressing of this stack to false
try
put 0 into xx
repeat for each item lName in pNames
add 1 to xx
put char 1 of item xx of pKinds into lKind
if lKind = "" then put lPrevKind into lKind
if lKind = "g" then do "global "&(lName)&CR&"put pValue into "&lName
else if lKind = "c" or lKind = "b" or lKind = "f" then put pValue into
fld lName
put lKind into lPrevKind
end repeat
catch lMess
answer "PutInto : Cannot handle "&lName&" !"
exit to top
finally
set the HCAddressing of this stack to lHCAddr
end try
end PutInto
***************
Hope this helps...
Jan
More information about the use-livecode
mailing list