>Hi all
>
>I wanted to loop through all controls on a form and if an instance of a particular class is found I wanted a method of this class to be executed, can SetAllX do this?
>
>Further, this called method will return a logical value depending on which I want the calling code to stop further processing, so out of multiple instances even if one of them returns a .F. I want the calling code to stop executing. So is it possible to get a list of return values from SetAllX?
>
>Please advise.
If all controls are direct controls of your form you could loop using controls collection, check if that method is defined on control, call the method and if returns false exit loop. Something like:
for each oControl in thisform.Controls
if PemStatus( oControl, 'myMethod', 5 ) and ;
lower(PemStatus( oControl, 'myMethod', 3)) == 'method' and ;
!PemStatus( oControl, 'myMethod', 2)
if !oControl.myMethod()
exit
endif
endif
endfor
For a sample doing that on selected controls no matter how deep they are check foxyclasses' udfObjCollector ExecAll() sample.
Cetin