Partager via


How to: View and Change Environment Settings

To view and change environment settings, use the Options dialog box. The Options dialog box contains a series of tabs representing different categories of environment options.

To display the Options dialog box

  • On the Tools menu, click Options.

The Options dialog box appears and displays tabs from which you can choose desired settings. For details about options you can set using each tab, see the Options Dialog Box (Visual FoxPro).

Displaying Environment Settings

When you run Visual FoxPro, you can verify environment settings by using the Options dialog box or the DISPLAY STATUS Command. Also, you can display the values of individual SET Commands to verify settings.

To display multiple environment settings

  • On the Tools menu, click Options to display the Options dialog box and view the current settings.

     – OR – 

  • Type DISPLAY STATUS in the Command window.

To display individual environment settings

  • Use the SET( ) Function in the Command window to display the current value of any SET commands.

For example, to view the current status of SET TALK, type:

? SET("TALK")

Note

Because settings are valid only for the current data session, you must capture your settings and place them in a program or a form's Init event code for every private data session.

For more information, see SET Command Overview.

To echo Options dialog box settings to the Debug Output window

  1. On the Tools menu, click Debugger.

  2. Click the main Visual FoxPro window to select it and on the Tools menu, click Options**.**

  3. In the Options dialog box, make setting choices.

  4. Hold down the SHIFT key and click OK.

    The settings are echoed to the Debug Output window.

  5. Click the Visual FoxPro Debugger window to select it and copy the setting commands from the Debug Output window.

Saving Environment Settings

You can save the settings you make in the Options dialog box for the current data session or as default (permanent) settings for your copy of Visual FoxPro.

To save settings for the current session only

  1. In the Options dialog box, select your settings.

  2. Click OK.

When you save settings for the current session only, they remain in effect until you quit Visual FoxPro (or until you change them again). To save changes permanently, save them as default settings. This action stores your settings in the Windows registry.

To save current settings as default settings

  1. In the Options dialog box, select your settings.

  2. Click Set As Default.

    Note

    The Set as Default button is disabled until you make a change to the current settings.

You can override default settings either by issuing SET commands or by specifying a configuration file when you start Visual FoxPro. For details, see Setting Configuration Options at Startup.

Setting the Environment Using the SET Command

You can programmatically modify most options displayed on the tabs in the Options dialog box using SET commands or by assigning a value to a system variable.

Note

When you configure the environment using SET commands, the settings take effect only for the current session of Visual FoxPro. When you quit the program, the system discards your settings. This means you must reissue the SET commands. However, you can automate this process by issuing SET commands at startup or using a configuration file. For details, see Setting Configuration Options at Startup.

Tip

To save a configuration made with SET commands, open the Options dialog box and save your settings there.

To set the environment programmatically

  • Use the SET commands that you want.

For example, the following lines of code set a default path, add a clock to the status bar and use a year-month-date (yy.mm.dd) format for dates:

SET DEFAULT TO HOME()+"\VFP"
SET CLOCK ON
SET DATE TO ANSI      

For more information, see SET Command Overview.

See Also

Tasks

Get Application Information from the Windows Registry Sample

How to: Change Configuration Settings in the Windows Registry

Reference

DISPLAY STATUS Command

Other Resources

Visual FoxPro Environment Settings