***************************************************************
* method : BaseApp : Util : ContainerProp
* description : pass a container control, an array and the name of
* : property and this will fill the array with the
* : property values
*
* parameters : toContainer,aArray,cPropToFind
* toContainer : container object to search
* aArray : array to fill
* cPropToFind : property to provide values
* returns : aArray with two columns
* : first = cPropToFind value
* : second = control reference
* typ. call :
* revisions :
* written by : Don Simpson 04/10/02
****************************************************************
lparameters toContainer,aArray,cPropToFind
local nParas,cString,nRows,cConStr,oControl
#INCLUDE STRINGS.H
nParas = pcount()
do case
case nParas = 3 and vartype(toContainer) = "O" and this.IsContainer(toContainer)
* this is OK
otherwise
* this is NOT OK
assert .f. message ;
BADPARAMETERS_LOC + 'ContainerProp' + ;
WILLRETURN_LOC
return .F.
endcase
do case
case toContainer.BaseClass = "Pageframe"
cConStr = "toContainer.Pages"
case toContainer.BaseClass = "Optiongroup"
cConStr = "toContainer.Buttons"
case toContainer.BaseClass = "Grid"
cConStr = "toContainer.Columns"
otherwise
cConStr = "toContainer.Controls"
endcase
cString = "oControl." + cPropToFind
for each oControl in &cConStr
if pemstatus(oControl,cPropToFind,5) && 5 = exist
nRows = alen(aArray,1)
if not (nRows = 1 and empty(aArray[1]))
nRows = nRows + 1
endif && nRows = 1 and empty(aArray[1])
dimension aArray(nRows,2)
aArray[nRows,1] = evaluate(cString)
aArray[nRows,2] = oControl
endif && pemstatus(oControl,cPropToFind,5) && 5 = exist
*** recursive
= iif(this.IsContainer(oControl),;
this.ContainerProp(oControl,@aArray,cPropToFind),"")
next oControl && at this point I get a "Nesting error"
** next && alternate try
** endfor && alternate try
I have tried three different endings for the for each loop.
I get the same error even with a simple form - no pageframe, pages containers etc. so the number of recursive passes does not seem to be the problem.
Can anyone see my problem? Or does someone have or know of a utility to do this? I doubt I am breaking new ground here.Best Regards
Don Simpson