Hi Cetin,
What do you mean by checking them by names ?
I am checking them by baseclass, and then drill down accordingly.
You are right I did not include Command/Option group but this
can be arrangead easily. Especially that those two are getting accessed and passed to 'with_object'. So either can be relatively easily handled there, or built up within existing mechanisam. Most probably I will provide for this later today :)
Wait windowing names in 'with_object' method is there just to show that every & each object is being accessed. That method is to be used later in subclasses to handle real life code handling.
Thks for taking time to view & try code.
Any feedback is higly appreciated.
Rgds++
Sergio
>Srdjan,
>IMHO just checking by names is not enough nor flexible for determining container type objects. ie: In your code Commandgroup,OptionGroup... are missing. In FoxyClasses udfObjCollector class (which does drill down on objects) what I do is to check amembers(). If an object has members than it's a container type that you should drill down.
>Cetin
>
>>Hi Dragan,
>>Since we did more less the same thing more less the same way, I propose
>>we dare for more - together:)
>>
>>Here is basic code/idea how to drill down ALL objects starting with VFP
>>application object if requested, and then access everything within.
>>So let's see what (else) can be done with it.
>>
>>Difference in aproach is that i/o calling it via procs/funcs
>>user will simply subclass it and write it's own object handling
>>in special kind of listener method 'with_object' that gets EACH scanned object passed as parameter letting him do whatever he/she wants with it.
>>
>>I used similar aproach with XDIR tool for scanning directory structures
>>and I kind of liked it :)
>>
>>Just copy this code in a new prg and try it.
>>It shld work right away showing names of all object found within _vfp
>>object.
>>
>>
>>
>>local oGPRO
>>oGPRO=createobject('ObjectScanner')
>>oGPRO.scan_vfp()
>>
>>*oGPRO.scan_containtership(oFormReference)
>>*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
>> lparameters oObject
>> wait wind 'Scanning object [' + oObject.name + ']' timeout 0.5
>>
>>
>>enddefine
>>
>>
>>
>>Lets see where we can take it from here :)
>>If we come up with something usefull , then we can post it together
>>here on UT, or just add it to yr existing download.
>>
>>Rgds++
>>Sergio
>>
>>
>>
>>>>>You can curse at this all you want, but you can re-curse as well. Download #
21923.
>>>>
>>>>Hi Dragan,
>>>>I recursed it myself :)
>>>>See Message#
1045044 in this thread. It is also general purpose recursion
>>>>class but only within single form. I did not subclass it in my message for simplicity purposes.
>>>>
>>>>Will however take good look at yr GPR class
>>>>to see what else is there :)
>>>
>>>Probably not much. I tried to keep it fat-free, no salad.
>>>
>>>Maybe the example may give you some ideas.