local oGPRO oGPRO=createobject('ObjectScanner') oGPRO.scan_vfp() *oGPRO.scan_containtership(oFormReference) &&valid call for ***App GPRO define class ObjectScanner as shape procedure scan_vfp local i,oObj i=1 do while type('_vfp.objects(i)') <> 'U' oObj=_vfp.objects(i) do case case inlist(oObj.baseclass,'Form','Container','Toolbar') this.scan_containership(oObj) *Case it is formset do we bother handling that ? *Case it is collection then what ? (I am with VFP6) *Anything else ? otherwise this.with_object(oObj) endcase i=i+1 enddo procedure scan_containership lparameters oParentContainer local i,oControl for each oControl in oParentContainer.controls do case case oControl.baseclass="Pageframe" for i = 1 to oControl.pagecount this.scan_containership(oControl.pages(i)) next case oControl.baseclass="Container" this.scan_containership(oControl) case oControl.baseclass="Grid" for i = 1 to oControl.columncount this.scan_containership(oControl.columns(i)) next *** Addition to include Commandgroups and Optiongroups case inlist(oControl.baseclass,'Commandgroup','Optiongroup') for i = 1 to oControl.buttoncount this.with_object(oControl.buttons(i)) next otherwise this.with_object(oControl) endcase next this.with_object(oParentContainer) procedure with_object lparameters oObj wait wind 'Scanning object [' + oObj.name + ']' timeout 0.5 enddefineAnyway as I said this code is just an open idea
*FillCollection >Lparameters oContainerObject >Local ix, nMembers, lnExpand, oObjectRef, aContainerObjects[1] >nMembers = amembers(aContainerObjects, oContainerObject,2) >With this > For ix = 1 to nMembers && Start collecting > lnExpand = iif(type(".aCollection[1]")= "L",0,1) > Dimension .aCollection[alen(.aCollection,1)+lnExpand] > oObjectRef = eval("oContainerObject."+aContainerObjects[ix]) > .aCollection[alen(.aCollection,1)] = oObjectRef > IF LOWER(oObjectRef.BaseClass) # "olecontrol" ; > AND LOWER(oObjectRef.BaseClass) # "oleboundcontrol" > .FillCollection(oObjectRef) && Recurse > endif > Endfor >Endwith >*... >>Cetin
>>>>local oGPRO >>>>oGPRO=createobject('ObjectScanner') >>>>oGPRO.scan_vfp() >>>> >>>>*oGPRO.scan_containtership(oFormReference) &&valid call for >>>>*downsizing scan scope to a single containership. >>>> >>>> >>>>***App GPRO >>>>define class ObjectScanner as shape >>>> >>>> procedure scan_vfp >>>> local i,oObj >>>> i=1 >>>> do while type('_vfp.objects(i)') <> 'U' >>>> oObj=_vfp.objects(i) >>>> do case >>>> case inlist(oObj.baseclass,'Form','Container','Toolbar') >>>> this.scan_containership(oObj) >>>> >>>> *Case it is formset do we bother >>>> *handling that ? >>>> >>>> *Case it is collection then what ? (I am with VFP6) >>>> >>>> *Anything else like accessing all session objects ? >>>> >>>> otherwise >>>> this.with_object(oObj) >>>> >>>> endcase >>>> i=i+1 >>>> enddo >>>> >>>> >>>> procedure scan_containership >>>> lparameters oParentContainer >>>> local i,oControl >>>> for each oControl in oParentContainer.controls >>>> do case >>>> case oControl.baseclass=="Pageframe" >>>> for i = 1 to oControl.pagecount >>>> this.scan_containership(oControl.pages(i)) >>>> next >>>> >>>> case oControl.baseclass=="Container" >>>> this.scan_containership(oControl) >>>> >>>> case oControl.baseclass=="Grid" >>>> for i = 1 to oControl.columncount >>>> this.scan_containership(oControl.columns(i)) >>>> next >>>> otherwise >>>> this.with_object(oControl) >>>> endcase >>>> next >>>> this.with_object(oParentContainer) >>>> >>>> >>>> procedure with_object && Listener method >>>> lparameters oObject >>>> wait wind 'Scanning object [' + oObject.name + ']' timeout 0.5 >>>> >>>> >>>>enddefine >>>> >>>>>>>>