General information
Category:
Coding, syntax & commands
Title:
Use of #DEFINE in form methods
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only