Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nesting error drilling into form controls
Message
From
11/04/2002 15:42:20
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Nesting error drilling into form controls
Miscellaneous
Thread ID:
00643923
Message ID:
00643923
Views:
42
I am writing code to drill down into a form and bring up all properties and references to the control which contain them.

I want to return all 'ControlSources' for example.

What I have written fails giving me a "Nesting Error" when it hits the last line.


***************************************************************
* 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
Next
Reply
Map
View

Click here to load this message in the networking platform