Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

These system variables are all hooks. They let you specify a program or application that should run under specific circumstances. A number of them are unused in Visual FoxPro.

The table below shows the purpose of each hook and its default value. You can change the value of any of these in several ways: Assign it a new value in a program or the Command Window, assign it a value in your Config.FPW file, or, for several of them, set it in the Tools | Options dialog.

Variable

Default value

Purpose

_BEAUTIFY

HOME() + "BEAUTIFY.APP"

Points to the Documenting Wizard, which is used to produce formatted code and other documentation, like a cross-reference. Unused in VFP 3.

_BROWSER

HOME() + "BROWSER.APP"

Called when you choose Class Browser from the Tools menu or click the Class Browser button on the Standard toolbar. Don't confuse this variable with the _OBROWSER variable created by running the Browser. That one isn't a system variable and can be released. In VFP 3, this is available only in the Professional edition.

_BUILDER

HOME() + "BUILDER.APP"

Called when you run a builder from any location.

_CONVERTER

HOME() + "CONVERT.APP"

Called when you open a FoxPro 2.x (or older) project, form or report. In VFP 5 and later, also called when you open a VFP 3 project.

_FOXDOC

""

In FoxPro 2.x, called when you choose FoxDoc from the Program menu. Unused in VFP.

_FOXGRAPH

""

In FoxPro/DOS, provided a hook to a graphing package. Unused in VFP.

_GALLERY

HOME() + "GALLERY.APP"

Added in VFP 6. Called when you choose Component Gallery from the Tools menu.

_GENGRAPH

HOME() + "WIZARDS\WZGRAPH.APP"

Points to the Graph Wizard, which provides an interface to MS Graph.

_GENHTML

HOME() + "GENHTML.PRG"

Added in VFP 6. Called when you choose Save As HTML from the File menu.

_GENMENU

HOME() + "GENMENU.FXP" or HOME() + "GENMENU.PRG"

Called when you choose Menu | Generate from inside the Menu Designer and when you build a project including a menu.

_GENSCRN

""

In FoxPro 2.x, called to convert SCX screen files into SPR screen programs. Unused in VFP.

_GENXTAB

HOME() + "VFPXTAB.PRG"

Called by programs created in the Query Designer with the CrossTab check box checked.

_GETEXPR

""

This variable may be one of the coolest additions in VFP 6. It lets you specify your own substitute for the Expression Builder. Whatever you specify is called by GETEXPR.

_OBJECTBROWSER

HOME() + "OBJECTBROWSER.APP"

Added in VFP 7. Called when you choose Object Browser from the Tools menu or click the Object Browser button on the Standard toolbar.

_SCCTEXT

HOME() + "SCCTEXT.PRG"

Added in VFP 5, called to convert forms, classes and other non-text files to a textual format for storage in a source control provider.

_SPELLCHK

HOME() + "SPELLCHK.APP" in VFP 6 and earlier. "" in VFP 7.

In VFP 6 and earlier, called when you choose Spelling from the Tools menu. In VFP 7, that option is gone. You can set it to call your own spell checker app, if you have one. (Consider writing Automation code to call on Word's Spell Checker.)

_TRANSPORT

""

In FoxPro 2.x, called when you open a project, form, report or label on a platform other than the one on which it was last edited. Unused in VFP—it uses _CONVERTER, above, instead.

_WIZARD

HOME() + "WIZARD.APP"

Called when you choose any wizard from any location.

Note that some of these variables (like _BEAUTIFY) just give you a reference to the program in use—changing these variables doesn’t affect what happens when you call the appropriate tool from the menu. (There’s one exception here. If you set _BEAUTIFY to the empty string, the menu option is disabled.) Others specify the program that’s actually called—changing one of these means that, when you call that tool from the menu, the newly specified program is executed, not the default. In the table, the ones that simply provide a reference use the term “points to,” while the others say “called.”

In addition to the automatic ways in which the hooked programs are called, you can run them yourself using DO (_variable). In many cases, you’ll need to pass appropriate parameters. See “Builders and Wizards (and Bears, Oh My!)” in Section 5 for the necessary parameters in those cases. Read the source code for VFPXTab and SCCTEXT, and the help file for BROWSER.APP.

You may also want to consider overriding the default setting of these variables with your own, improved code.

The unused variables provide a place to store permanent information. Unlike variables you create, nothing you can do releases these variables. They’re as persistent as they come. You might use them to store vital information. (If you take this approach in an application, be sure to document it really well. We use these variables primarily to enhance our development environments.) You might also use them as hooks into things you’re interested in. See _ASSIST for an example.

Example

* Run a crosstab
DO (_GENXTAB) WITH "Result"

See Also

_Assist, _CodeSense, _Coverage, _GenPD, GetExpr, _Startup, _TaskList