lPara tcMethod, toContainer, tcClass LOCAL lcMethod, loContainer, loControl, loPage, loColumn, lcSetExact IF TYPE('tcMethod') <> "C" RETURN .F. ELSE lcMethod = tcMethod ENDIF * If no container object was passed in, assume that * we are running all methods in THIS IF TYPE("toContainer.Name") <> "C" loContainer = THIS ELSE loContainer = toContainer ENDIF * set exact on to make sure pages weren't mistaken for pageframes and vice-versa lcSetExact = SET('EXACT') SET EXACT ON * this method only works for container-type classes IF !INLIST(LOWER(loContainer.BaseClass), "form","container","pageframe","page","grid","column") RETURN .F. ENDIF DO CASE CASE INLIST(LOWER(loContainer.BaseClass),"form","container","page","column") FOR EACH loControl IN loContainer.Controls * Does the control have the method passed in? IF PEMSTATUS(loControl, lcMethod, 5) =EVAL("loControl." + lcMethod + "()") ENDIF * if the control is a container itself, recurse back into this method to drill down into its controls IF INLIST(LOWER(loControl.BaseClass), "form","container","pageframe","page","grid","column") THIS.RunAll(lcMethod, loControl) ENDIF ENDFOR * I am really doing the same thing for all three of these container types, * but the controls collection is called something different in each of them, * so I had to separate them out, CASE LOWER(loContainer.BaseClass) = "pageframe" * For pageframes, iterate through the pages collection FOR EACH loPage IN loContainer.Pages IF PEMSTATUS(loPage, lcMethod, 5) =EVAL("loPage." + lcMethod + "()") ENDIF THIS.RunAll(lcMethod, loPage) ENDFOR CASE LOWER(loContainer.BaseClass) = "grid" * For grids, iterate through the columns collection FOR EACH loColumn IN loContainer.Columns IF PEMSTATUS(loColumn, lcMethod, 5) =EVAL("loColumn." + lcMethod + "()") ENDIF THIS.RunAll(lcMethod, loColumn) ENDFOR ENDCASE SET EXACT &lcSetExact