Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use of #DEFINE in form methods
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00770203
Message ID:
00770264
Vues:
17
>I have a button click method calling a bunch of form methods as follows:
>
>WITH oDataStore
> IF xyz
> THISFORM.MyOtherMethod
> ENDIF
>ENDWITH
>
>In each of the 'MyOtherMethods' I have the following code at the top:
>
>#IF .F.
> LOCAL oDataStore AS DataStore OF MyLibrary
>#ENDIF
>#DEFINE oDataStore
>
>I am trying to achieve 2 things:-
>
>1. to be able to use VFP7's Intellisense engine by declaring oDataStore as LOCAL in each method
>
>2. to remove references to oDataStore when saving the form
>
>Part 1 means that when I type "oDataStore." in the method, I get the list of PEMs for the object. Very handy!
>
>Part 2 means that when I save the form, the "#DEFINE oDataStore" removes all references to oDataStore within the method. So rather than having say oDataStore.Height I just have .Height and, because it is within a WITH...ENDWITH, it should run a bit faster.
>
>The problem is that when I save the form, the #DEFINE in the individual methods seems to be working in all methods of the form. I don't want this because in the Init event, I have the line PUBLIC oDataStore but the #DEFINE appears to remove oDataStore from this line, leaving just PUBLIC which causes an error.
>
>Has anyone else come across this behaviour? Any ideas on how to stop it?
>
>Thanks,
>
>Stewart


I would expect it to also remove the oDataStore from the WITH statements. You have not gotten there yet due to the INIT method.

Instead of oDataStore use something else for the LOCAL and .HEIGHT lines that works for you. Maybe o_DataStore or ooDataStore.

Tracy
Tracy
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform