The information in this article applies to:
SUMMARYThis article briefly describes some of the changes found in Visual FoxPro 3.0 and how to use the new features. MORE INFORMATION_SCREEN and activeControl PropertyIn previous versions of FoxPro, you may have used the FoxPro system variable _CUROBJ to refer to the object that currently had the focus. Although the _CUROBJ variable has been retained for backward compatibility, Microsoft recommends that you now refer to an object or control on a form by using the _SCREEN reference and activeControl property. To return the name of the control that has the focus use this code:
-or-
-or- (if the form is part of a formset)
To return the name of the current control, use this code:
-or-
-or- (if the form is part of a formset)
To set the caption of the current control, use this code:
-or-
-or- (if the form is part of a formset)
To move the cursor to a control, use this code:
-or-
-or- (if the form is part of a formset)
NOTE: <controlname> is the name of the control you wish to become active.
/N Parameter on the RUN CommandThe RUN command is available on the Windows platform only. The RUN command in FoxPro for Windows has a /N parameter that allows you to launch a Windows-based application. In fact, FoxPro for Windows introduced the /N option for executing windows-based applications from FoxPro. This functionality is retained in Visual FoxPro. The following command launches Word for Windows, and opens the readme document.
The Microsoft Windows Control Panel contains many utilities that you can
use in your applications. You can also call these utilities using the RUN
command:
You can include an optional numeric value immediately after /N to specify
how the Windows-based application is opened. Do not include any spaces
between /N and the numeric value. The following table lists the numeric
value you can include and describes the state of the Windows-based
application when opened.
Drives and DirectoriesSeveral FoxPro functions can be used to obtain information about drives and directories. Compare the returned values after issuing the command SET DEFAULT TO C:\VFP.Drive:
Directories:
You can also use the ADIR() function to see if a specific directory exists.
The following example returns 0 only if the path name does not exist.
Remember that the path to a network server may not exist if the network
connection is broken.
USE CommandYou can run the USE IN 0 command to open a table or .dbf file in the first available work area. This command does not select that work area in which it opened the table or .dbf file. You must use the SELECT command to do this. You can issue the command USE IN <alias> to close a table or .dbf file without selecting its work area.A new SHARED clause for the USE command allows you to open a table or .dbf file for shared use without using the SET EXCLUSIVE command. For more information about the USE command, refer to the USE topic in the Help file. Cross-Tab Output to SpreadsheetsGenxtab has been replaced by the Fpxtab program and is called from the code created by the Query Wizard. After running the Query Wizard select the Cross-Tab Wizard from the first screen, and follow the instructions to create a table that can then be exported or copied to spreadsheets.Custom MessagesYou can display custom messages in the FoxPro status bar. To do this, type the following in the Command window:
Where <expC> is the message. (You can pass a null string to display
nothing.) SET MESSAGE TO without a parameter will restore the status bar to
its normal functionality.
Preprocessor DirectivesDo not use _WINDOWS, _DOS, _MAC, or _UNIX with preprocessor directives (that is, #IF...#ENDIF). These are designed to be runtime variables. For example the following will NOT work:
This code would not work because _DOS would be changed to .T. and _WINDOWS
would be changed to .F. so that the code could never work properly again.
Instead use the following:
Preprocessor Substitution in Text StringsIn FoxPro 2.6, #define prevented preprocessor substitution in text strings. This has been remedied in Visual FoxPro. The following code will work as expected returning the text 'test' from the function call. In FoxPro 2.x this would have resulted in a 'NOSUB not found error' message. This is because of the way the '[]' characters were evaluated.
Development ToolsThe Foxtools.fll file, which is located in your FoxPro for Windows root directory, contains a variety of functions you can use to enhance your applications. Many of these functions provide access to API routines and Microsoft Windows functions. You can view these by using the DISPLAY STATUS command (after you use SET LIBRARY TO foxtools). Use of the window API routines is also supported through the use of the DECLARE statement.Additional query words:
Keywords : kbnokeyword kbMAC kbVFp300 kbVFp500 kbVFp600 |
Last Reviewed: August 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |