Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Location of #INCLUDE command

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
There is a file of constant definitions, amdefn.h, which has the definition of several constants, e.g:

Code:
#define amCREDIT       “SC”

These constants are to be used within several methods of the classes in a visual class library. Where do I need to put the #include amdefn.h ? Is it needed in each method which makes use of the constants in this file of definitions?

Thanks. Andrew
 
A VCX class has a property for this, so you set it for the whole class and can use it in all methods. While in the class designer, the Class menu has an item "Include file", you can specify one include file only, but you can use #include in such files.

In a PRG file it's sufficient to have this or many precompiler directives at the top, the precompiler uses the included defines for all code below the include, not only the current class or method.

Bye, Olaf.
 
Andrew,

In the Class Designer, open the Class menu and select Include File ... You will be given a dialogue in which you enter the name (and path) of the file. The file will then be available for all methods in that class.

Similarly with the Form Designer.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you Olaf, for your very clear and helpful reply.

Andrew
 
Just for the record, I edited my reply and in the meantime Mike said how to get to the class property, too, if anybody wonders why.

And on topic: The class setting is a class setting, there is no equal setting for all classes of the whole VCX library, in a PRG (again said) all following lines are influenced, so this has effect on all DEFINE CLASS/ENDDEFINE sections at the same time, therefore this can make a difference, when exporting vcx class code via class browser into a viewcode.prg. You may came from there and have identified a problem with the constants in the result prg code.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top