Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to end a macro
Message
De
17/04/2006 18:34:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
17/04/2006 18:24:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01114170
Message ID:
01114175
Vues:
16
>How does one terminate a macro when a period and membername follow. I tried class&mac..membername syntax, but that didn't work. I know it can be done, I just don't remember the trick. TIA.

I don't know whether you can make that approach work, but you can usually macro-expand a larger part of the command, or even an entire command.

For example, in your example I assume "mac" might contain something like "ThisForm". Make a second macro, mac2 = "ThisForm.MemberName", and use it in the macro expansion.

Note that you can also assign objects in an object hierarchy to a variable; this might be more efficient than macro expansion.
obj = ThisForm.TextBox1
obj.Visible = .T.
If you need to process several objects with similar names, like Label1, Label2, etc., in a loop, you might proceed as follows:
i = 1
lcTextBox = "ThisForm.Label" + trans(i)
obj = eval(lcTextBox)
obj.Caption = "Hello, there."
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform