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!

#INCLUDE directive in Menu Designer. 1

Status
Not open for further replies.

CajunCenturion

Programmer
Mar 4, 2002
11,381
US
In one project, there is a mainmenu.mnx which on several submenus, contains in the Skip For prompt option, a function all to a permission routine.

Skip For = "HavePermission(PERMISSION_CODE)"

The various PERMISSION_CODE values are defined in an include file and at run time, I'm getting a "variable does not exist" error when referencing these symbolic constants. The include file is part of the project, included in the main.prg, and in several forms, but how does connect the include file to a menu?

Thanks.

--------------
Good Luck
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 

How are you specifying the Include file? If you are using _INCLUDE (or the corresponding setting in Tools / Options / File Locations), then it won't work for menus. This is from the Help for _INCLUDE:

Specifies a default header file of predefined compile-time constants automatically included with user-defined classes, forms, or form sets

The file applies to classes, forms and form sets, but not program files (which includes the MPR files generated by the menu designer).

To establish an Include file for a program file, you have to use the #INSERT directive. You don't want to put that in the MPR file manually, but you might be able to put it in the Menu Setup code (Menu designer -> View -> General Options).

Give it a try.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks for the help.

As it turns out, this project was originally built in VFP 7.0 and apparently, the menus were not rebuilt when the project was converted to VFP 8.0. Once the project was completely rebuilt and then recompiled, everything seemed fine.

It seems that the connection between a menu and an include file is via the form which hosts the menu. From the IDE menu, select Forms->Include File and specific the include file, then rebuild and recompile the project.

Does this sound reasonable?

--------------
Good Luck
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Glad you've got it working.

It seems that the connection between a menu and an include file is via the form which hosts the menu. ...

Does this sound reasonable?

Yes, provided the menu is "hosted" by a form. In my apps, the menus are more often launched from the main program, and are independent of any particular form (with the exception of shortcut menus).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
No, it doesn't make sense that the menu could pick up the Include file from the form. #DEFINEs are a compile-time construct, and the menu wouldn't know about the form until runtime.

Tamar
 
==> No, it doesn't make sense that the menu could pick up the Include file from the form. #DEFINEs are a compile-time construct, and the menu wouldn't know about the form until runtime.

Then how can you reference #DEFINEs from inside a menu?

--------------
Good Luck
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Then how can you reference #DEFINEs from inside a menu?

You put your #INCLUDE in the setup code of the menu itself, as explained above.
 
Thank you.

--------------
Good Luck
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top