Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loop thru all controls without recursive
Message
 
 
À
11/01/2004 10:58:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00865729
Message ID:
00866047
Vues:
27
John,

>May I have both?

With a recursive routine that becomes a simple matter of whether you call the function before or after you make the recursive call.

Why do you not want a recursive routine? It truly is the easiest way to iterate contained objects.
function ObjectIterate( roObject, pcFunction )

local loObject

eval( pcFunction + "( roObject )" ) && breadth first if called here

if ( pemstatus( roObject, "Objects", 5 ) )
   for each loObject in roObject.Objects
      ObjectIterate( loObject, pcFunction )
   endfor
endif

* eval( pcFunction + "( roObject )" ) && depth first if called here
return
and it's easy to use with code like:

ObjectIterate( oPickNode, "test1" )

ObjectIterate( _screen.forms[1], "test1" )

ObjectIterate( this, "test1" )


function test1( roObject )

debugout roObject.Name
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform