Information générale
Catégorie:
Codage, syntaxe et commandes
>Is there a clipper's aEval() function equivalent in VFP ?
I would say that using polymorphism you can accomplish the same thing in VFP; this is, instead of passing/evaluating codeblocks, pass different objects that all have the same method name(s) but perform differently based on the circumstances and any parameters that may be passed (when the same method name is called).
On the other hand, you can utilize some of the VFP "automation server methods" to execute VFP command. These methods were primarily intended for "other applications" that wanted to communicate with a given VFP "application object"; however, they can also be used by the VFP app itself, eg:
m.b = "STORE 'Hello, World' TO m.a"
_VFP.DoCmd( m.b )
? m.a
_VFP.DoCmd( "MESSAGEBOX( 'Bye' )" )
For more complex cases, you could generate code on the fly using various string/file functions, compile it using COMPILE <...> and then run it via DO <...>
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement