Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nesting error drilling into form controls
Message
From
15/04/2002 08:27:31
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00643923
Message ID:
00644970
Views:
9
Nadya,

I have gotten this code to work by changing the "for each oControl in this.Controls" to the older for form of "for nControl = 1 to this.ControlCount, oControl = this.Controls[nControl], endfor".

For whatever reason this works and the "for each" form does not.

As always I appreciate your help. While you did not hit exactly on it you forced me to think a little different and that's what I needed.

VBR Don

>Hi Don,
>
>From the first sight there is nothing wrong in the code. I would achange this code a little bit: (see inside)
>
>>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
>&& May be the problem is in PemStatus? alternative way (longer) would be to try
>type(cString)<>"U"
>>		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),"")
>        if this.IsContainer(oControl) && I would not use IIF here
>             this.ContainerProp(oControl,@aArray,cPropToFind)
>         endif
>>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.
>
>I have a code, which drills through form controls, but let's try this version of code first...
Best Regards
Don Simpson
Previous
Reply
Map
View

Click here to load this message in the networking platform