Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Repeating piece of code
Message
De
02/04/2013 09:20:24
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01569704
Message ID:
01569721
Vues:
50
>It would be very useful because when you write inside a procedure it will not work,
>if inside the procedure there are lines as thisform.command1.click, etc.

Not sure what you mean when you say the call to the statement "thisform.command1.click" will not work when called. You are correct that the "click" event is not called when you execute that statement; but the code in the method "click" that you enter will be executed when you call the statement.

I know that some say that you should never put code in the the event methods -- but then if this is followed to the extreme then there would never be any code there... So what is the difference in the two different calls - the first with the code embedded in the click method:
PROCEDURE Click
WAIT WINDOW "Some code lines" NOWAIT
ENDPROC
The second has a call to an external procedure:
FUNCTION Click
DO CalledByClick
ENDFUNC
PROCEDURE CalledByClick
WAIT WINDOW "Some code lines" NOWAIT
ENDPROC
I do not see any difference in the above except that there is another calling layer in the second. I routinely place code into the event methods and then will call these directly if applicable. For instance, if I have a 'Save' buttton then I add the code to perform the save into the click method of this button. Then if elsewhere I need to call the code to perform the save operation, then I will call "thisform.cmdSave.Click()".
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform