Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of #DEFINE in form methods
Message
From
26/03/2003 09:47:21
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Use of #DEFINE in form methods
Miscellaneous
Thread ID:
00770203
Message ID:
00770203
Views:
48
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
Map
View

Click here to load this message in the networking platform