define class myObjectDrill as ObjectScanner ***We write specific purpose here procedure with_object lparameters oObj if oObj.... . . enddefine **and use it from anywhere we want. local oRO oRO=createobject('myObjectDrill') oRO.scan_vfp() * or oRo.scan_containership(oObjectReference)Hope this throws more light to what I am trying to achieve here.
>>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 >> >> >>enddefine >> >>>>