Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FoxPro Crash When I do...
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00080054
Message ID:
00080135
Views:
24
>>In the LoadSave method I use PEMSTATUS() and the macro "&" commands.
>>>What can cause this?
>Jean-Rene,
>
>Can you post the code in LoadSave, that is where your problem likely is and it is very hard to guess what might be doing it without seeing the code.
>
>Calling PEMSTATUS() more than one time in a line of code can leave object references lying around. For example;

The LoadSave() methode is use to save or load value of property listed in cPropertySaved
This is the code in the method LoadSave():
lparameter lcLoadString

local lnbItem,laProperty,lcReturnStr,lnInd,lcTypeTest,lcOldErr,;
lnNbRow,lnNbCol,lcPropValue,lcElemType,lxElemValue
local lcWorkString,llInWork
if empty(This.cPropertySaved)
return ""
endif

dimension laProperty[1]
lnbItem = ListToArray(@laProperty,",",this.cPropertySaved)
lcReturnStr = ""
*set step on
if empty(lcLoadString) && We are saving
for lnInd = 1 to lnbItem
lcTypeTest = eval("this."+laProperty[lnInd ])
lcOldErr = SaveError("lnNbRow =0")
lnNbRow = eval("alen(" + "this."+laProperty[lnInd ]+ ", 1)")
=SaveError(lcOldErr )
lcTypeTest = iif(lnNbRow > 0 ,"A",type("this."+laProperty[lnInd ]) )
lcReturnStr= iif(empty(lcReturnStr ),"",lcReturnStr +chr(13))

do case
case lcTypeTest ="C"
lcPropValue = this.&laProperty[lnInd ]
lcPropValue = strtran(lcPropValue ,chr(13),"%*")
lcReturnStr = lcReturnStr +"~C["+laProperty[lnInd ]+"]="+;
lcPropValue
case lcTypeTest ="N" or lcTypeTest ="Y"
lcPropValue = str(this.&laProperty[lnInd ])
lcReturnStr = lcReturnStr +"~N["+laProperty[lnInd ]+"]="+;
lcPropValue
case lcTypeTest ="D" or lcTypeTest ="T"
lcOldSDate = set("Date")
lcOldCentury=Set("Century")
set date to ymd
set century on
lcPropValue = dtoc(this.&laProperty[lnInd ])
set date to &lcOldSDate
set century &lcOldCentury
lcReturnStr = lcReturnStr +"~D["+laProperty[lnInd ]+"]="+;
lcPropValue
case lcTypeTest ="L"
lcPropValue = iif(this.&laProperty[lnInd ],"T","F")
lcReturnStr = lcReturnStr +"~L["+laProperty[lnInd ]+"]="+;
lcPropValue
case lcTypeTest ="A"
lcFullName = "this." + laProperty[lnInd ]
lnNbCol = eval("alen(" + "this."+laProperty[lnInd ]+ ", 2)")
lnNbCol = iif(lnNbCol = 0,1,lnNbCol )
lcReturnStr = lcReturnStr +"~A["+laProperty[lnInd ]+;
"("+str(lnNbRow ,4)+","+str(lnNbCol ,4)+")]="
lcPropValue = ""
for ln = 1 to lnNbRow * lnNbCol
lcElemType = type(lcFullName + "[" + str(ln, 5, 0) + "]")
if lcElemType = "O"
lcElemType = ""
else
lxElemValue = eval(lcFullName + "[" + str(ln, 5, 0) + "]")
endif
do case
case lcElemType = "N" or lcElemType = "Y"
lxElemValue = str(lxElemValue)
case lcElemType = "D" or lcElemType = "T"
lcOldSDate = set("Date")
lcOldCentury=Set("Century")
set date to ymd
set century on
lxElemValue = dtoc(lxElemValue)
set date to &lcOldSDate
set century &lcOldCentury
case lcElemType = "L"
lxElemValue = iif(lxElemValue, "T", "F")
endcase
lcPropValue = lcPropValue +iif(empty(lcPropValue),"","!|")+;
lcElemType +"!\"+lxElemValue
endfor
lcPropValue = lcPropValue + "!|"
lcReturnStr = lcReturnStr + lcPropValue
case lcTypeTest ="O" and PEMSTATUS(this.&laProperty[lnInd ],"LoadSave",5)
lcReturnStr = lcReturnStr +"~O["+laProperty[lnInd ]+"]=!{"
lcPropValue = this.&laProperty[lnInd ]..LoadSave() +"}!"
lcReturnStr = lcReturnStr + lcPropValue
endcase
endfor

else && We are Loading

llInWork = .t.
lcWorkString = lcLoadString
lcTmpstr = ""
do while !empty(lcWorkString) and llInWork
do case
case left(lcWorkString ,2) = "~C"
lcTmpstr = left(lcWorkString ,at(chr(13),lcWorkString,1) )
lcWorkString = strtran(lcWorkString,lcTmpstr )
lcTmpstr = strtran(lcTmpstr ,"~C")
lcPropName = left(lcTmpstr ,at("]=",lcTmpstr,1)+1 )
lcTmpstr = strtran(lcTmpstr ,lcPropName )
lcPropName = strtran(strtran(lcPropName ,"["),"]=")
if PEMSTATUS(this ,lcPropName ,5)
lcTmpstr = strtran(lcTmpstr ,chr(13))
lcTmpstr = strtran(lcTmpstr,"%*",chr(13) )
this.&lcPropName = lcTmpstr
endif
case left(lcWorkString ,2) = "~N"
lcTmpstr = left(lcWorkString ,at(chr(13),lcWorkString,1) )
lcWorkString = strtran(lcWorkString,lcTmpstr )
lcTmpstr = strtran(lcTmpstr ,"~N")
lcPropName = left(lcTmpstr ,at("]=",lcTmpstr,1)+1 )
lcTmpstr = strtran(lcTmpstr ,lcPropName )
lcPropName = strtran(strtran(lcPropName ,"["),"]=")
if PEMSTATUS(this ,lcPropName ,5)
lcTmpstr = strtran(lcTmpstr ,chr(13))
this.&lcPropName = val(lcTmpstr )
endif
case left(lcWorkString ,2) = "~D"
lcTmpstr = left(lcWorkString ,at(chr(13),lcWorkString,1) )
lcWorkString = strtran(lcWorkString,lcTmpstr )
lcTmpstr = strtran(lcTmpstr ,"~D")
lcPropName = left(lcTmpstr ,at("]=",lcTmpstr,1)+1 )
lcTmpstr = strtran(lcTmpstr ,lcPropName )
lcPropName = strtran(strtran(lcPropName ,"["),"]=")
if PEMSTATUS(this ,lcPropName ,5)
lcTmpstr = strtran(lcTmpstr ,chr(13))
lcOldSDate = set("Date")
lcOldCentury=Set("Century")
set date to ymd
set century on
this.&lcPropName = ctod(lcTmpstr )
set date to &lcOldSDate
set century &lcOldCentury
endif
case left(lcWorkString ,2) = "~L"
lcTmpstr = left(lcWorkString ,at(chr(13),lcWorkString,1) )
lcWorkString = strtran(lcWorkString,lcTmpstr )
lcTmpstr = strtran(lcTmpstr ,"~L")
lcPropName = left(lcTmpstr ,at("]=",lcTmpstr,1)+1 )
lcTmpstr = strtran(lcTmpstr ,lcPropName )
lcPropName = strtran(strtran(lcPropName ,"["),"]=")
if PEMSTATUS(this ,lcPropName ,5)
lcTmpstr = strtran(lcTmpstr ,chr(13))
this.&lcPropName = iif( alltrim(lcTmpstr)="T",.t.,.f.)
endif
case left(lcWorkString ,2) = "~A"
lcTmpstr = left(lcWorkString ,at(chr(13),lcWorkString,1) )
lcWorkString = strtran(lcWorkString,lcTmpstr )
lcTmpstr = strtran(lcTmpstr ,"~A")
lcPropName = left(lcTmpstr ,at("]=",lcTmpstr,1)+1 )
lcDim = substr(lcPropName ,at("(",lcPropName ,1) )
lcPropName = strtran(lcPropName , lcDim )
lcTmpstr = strtran(lcTmpstr ,lcPropName +lcDim )
lcPropName = strtran(lcPropName ,"[")
lcDim = lcPropName +strtran(lcDim ,"]=")
if PEMSTATUS(this ,lcPropName ,5)
dimension this.&lcDim
lcTmpstr = strtran(lcTmpstr ,chr(13))
for lnind = 1 to alen(this.&lcPropName )
lcTmpStr2 = left(lcTmpstr,at("!|",lcTmpstr)+1 )
lcTmpstr = STRTRAN(lcTmpstr,lcTmpStr2,"",1,1)
lcTmpStr2 = strtran(lcTmpStr2 ,"!|")
lcTYPE = LEFT(lcTmpStr2 ,AT("!\",lcTmpStr2)-1)
lcTmpStr2 = SUBSTR(lcTmpStr2 ,AT("!\",lcTmpStr2)+2)
lcArrPos = lcPropName+"["+str(lnind)+"]"
do case
case lcTYPE = "C"
this.&lcArrPos = lcTmpStr2
case lcTYPE = "N"
this.&lcArrPos = val(lcTmpStr2 )
case lcTYPE = "D"
lcOldSDate = set("Date")
lcOldCentury=Set("Century")
set date to ymd
set century on
this.&lcArrPos = ctod(lcTmpStr2 )
set date to &lcOldSDate
set century &lcOldCentury
case lcTYPE = "L"
this.&lcArrPos = iif(alltrim(lcTmpStr2 )="T",.t.,.f.)
endcase
endfor
endif
case left(lcWorkString ,2) = "~O"
lcTmpstr = this.getObjStr(lcWorkString,"{","}" )
lcWorkString = strtran(lcWorkString,lcTmpstr )
lcTmpstr = strtran(lcTmpstr ,"~O")
lcPropName = left(lcTmpstr ,at("]=",lcTmpstr,1)+1 )
lcTmpstr = strtran(lcTmpstr ,lcPropName )
lcPropName = strtran(strtran(lcPropName ,"["),"]=")
if pemstatus(this,lcPropName ,5) and type("this."+lcPropName)="O"
if pemstatus(this.&lcPropName,"LoadSave",5)
this.&lcPropName..loadsave(lcTmpstr )
endif
endif


endcase
enddo
endif
*wait window padr(lcReturnStr,240)+"..."
return lcReturnStr
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform