Freigeben über


Enhanced Classes, Commands, and Functions

Visual FoxPro contains the following improvements to selected classes, commands, and functions:

  • Enhanced SQL Pass-Through functionality and language improvements
  • Multiple expressions of different data types in the DEBUGOUT command
  • Specifying external DataEnvironment classes for forms
  • Language support for collating sequences and autoincrementing field values
  • Support for FontCharSet property in AFONT()
  • HOME(8) returns Visual FoxPro Projects subdirectory
  • Toggle off-screen bitmaps
  • Component Object Model (COM) enhancements for improved array and type support
  • Hand pointer setting for MousePointer property
  • MaxLength property available for ComboBox controls
  • Language support for caption expressions
  • Changing the background color of the CommandButton control
  • Displaying images in a column header
  • ToolTipText and StatusBarText properties for all visual controls
  • Refresh method for Label and Shape controls
  • Providing multiple configuration files
  • Suppressing display of data-related messages in the status bar
  • SYS(2007) returning checksum values greater than 16 bits
  • Removing white space from text merges
  • Updating an existing object with values from current record using SCATTER...NAME
  • Specifying an object when inserting a new table record using SQL INSERT command
  • Hiding columns
  • CLEAR DEBUG resets Debugger windows when open and clears all breakpoints
  • Suspending program execution until a Windows event occurs
  • Checking for hidden or system files and directories
  • Retrieve container object reference in context with current code editing window
  • Specify name and location of mapping schema for XMLUPDATEGRAM( ) function

Enhanced SQL Pass-Through Functionality and Language Improvements

Visual FoxPro includes the following enhancements to SQL Pass-Through functionality and for shared connections.

Visual FoxPro now evaluates expressions that are passed as parameter values in a SQL statement to SQLEXEC( ). Previously, you were required to use a memory variable to pass any nonconstant values. You no longer need to enclose parameter expressions with parentheses. Visual FoxPro can now evaluate memory variable names, function calls, and parameter expressions. For more information, see SQLEXEC( ) Function.

Visual FoxPro allocates an Open Database Connectivity (ODBC) statement handle (HTSTMT) but uses an existing shared ODBC connection handle (HDBC) for every remote view that uses a shared connection. If the view does not use a shared connection, Visual FoxPro allocates a separate ODBC statement handle and ODBC connection handle.

Visual FoxPro uses the SQLEXTENDEDFETCH( ) function instead of the SQLFETCH( ) function for ODBC statement handles that use shared ODBC connection handles. Visual FoxPro sets statement options SQL_CURSOR_TYPE = SQL_CURSOR_STATIC and SQL_CONCURRENCY = SQL_CONCUR_READ_ONLY before SQLPrepare or SQLExecDirect for these ODBC statement handles. For more information about ODBC language, see the ODBC Programmer's Reference in the MSDN Library at https://msdn.microsoft.com/library/.

The SQLCONNECT( ) and SQLSTRINGCONNECT( ) functions return a numeric value as the statement handle rather than a connection handle, which you cannot obtain directly. You can still set and get connection properties using the SQLSETPROP( ) and SQLGETPROP( ) functions by passing the statement handle for that connection and the string, "Shared", as arguments. All other SQL functions use a statement handle instead of a connection handle. For more information, see SQLSETPROP( ) Function and SQLGETPROP( ) Function.

You can specify whether to create a shared connection using the new lShared and nStatementHandle parameters for the SQLCONNECT( ) function and the new lShared parameter for the SQLSTRINGCONNECT( ) function. You can also use SQLCONNECT( ) to obtain a new statement handle on a shared connection that was opened using SQLSTRINGCONNECT( ). In addition, you can specify optional values for the cUserID and cPassword parameters when using a named connection for cConnectionName. For more information, see SQLCONNECT( ) Function and SQLSTRINGCONNECT( ) Function.

Visual FoxPro supports overriding the default connection for a remote view and requires the new m.nStatementHandle parameter for supporting shared connections in the USE Command. For more information, see the USE Command.

When you include the SHARE keyword with the CONNECTION clause in the CREATE SQL VIEW command, Visual FoxPro uses new statement handle for the shared connection, if one is available. If a shared connection is not available, Visual FoxPro creates a shared connection when the view opens, which you might be able to share with other views. For more information, see CREATE SQL VIEW Command.

Multiple Expressions in the DEBUGOUT Command

You can evaluate multiple expressions of different data types and display their results in the Debug Output window using the DEBUGOUT command. For more information, see DEBUGOUT Command.

Specifying External DataEnvironment Classes for Forms

You can specify external DataEnvironment classes by setting the DEClass and DEClassLibrary properties for Form objects. For more information, see DataEnvironment Object, DEClass Property, and DEClassLibrary Property.

Language Support for Collating Sequences and Autoincrementing Field Values

You can now specify a collating sequence for an index tag when using the SQL CREATE TABLE, ALTER TABLE, and INDEX commands, which include the COLLATE clause.

The CREATE TABLE and ALTER TABLE commands support automatically incrementing field values by including the AUTOINC clause and specifying values for the NEXTVALUE and STEP clauses. The DISPLAYSTRUCTURE command displays the Next and Step values for fields that use autoincrementing.

For more information, see CREATE TABLE - SQL Command, ALTER TABLE - SQL Command, INDEX Command, and DISPLAY STRUCTURE Command.

You can also specify whether attempts to update values in a field using autoincrementing generate an error. For more information, see SET AUTOINCERROR Command or the AutoIncError property in the CURSORSETPROP( ) Function.

Support for FontCharSet Property in AFONT()

Visual FoxPro supports the FontCharSet property in the AFONT() function by providing two parameters, nFontCharSet and nFlags. The first parameter specifies the character set in the cFontName. The second parameter specifies a value of 1 and populates ArrayName with character sets that are available for a particular font. for more information, see FontCharSet Property and AFONT( ) Function.

HOME(8) Returns Visual FoxPro Projects Subdirectory

HOME(8) returns the Visual FoxPro Projects subdirectory, which is the default directory for new projects and files created by Visual FoxPro, located in the user's My Documents directory. For more information, see HOME( ) Function.

Toggle Off-Screen Bitmaps

Visual FoxPro includes support for turning off-screen bitmaps off and on using a configuration file setting. You can now use the SYS(602) - Bitmap Configuration function and the values of 0 and 1 to disable and enable off-screen bitmaps at run time.

For more information, see SYS(602) - Bitmap Configuration.

Component Object Model (COM) Enhancements for Improved Array and Type Support

Visual FoxPro improves its support for creating COM components and interoperability with other COM components by including the following COM enhancements:

  • Define and specify data types other than Variant for arrays

    You can specify a data type other than Variant in the DIMENSION command by using the AScType clause. However, you should still use the COMARRAY( ) function to control other settings for how arrays are passed to COM servers. For more information, see DIMENSION Command.

  • Strong typing of arrays for type libraries

    You can specify strong typing for arrays so they can be correctly written as a safe array to a type library when you use the new cArrayName[] parameter in the cArrayName[] [AS Type] [@] clause in the DEFINE CLASS command. For more information, see DEFINE CLASS Command.

  • Complex strong typing

    You can define a type based on a COM class using the cArrayName[] [AS Type] [@] ] [AS Type] clause in the DEFINE CLASS command. For more information, see DEFINE CLASS Command.

  • Specify how arrays are passed to COM objects using the COMARRAY( ) function

    You can specify that byte arrays should not be converted to strings by passing a value of 1000 to the nNewValue parameter in the COMARRAY( ) function. This enhancement improves support for how byte arrays are treated. For more information, see COMARRAY( ) Function.

  • Visual FoxPro now generates type libraries for COM Servers that mark Character types as BSTR instead of VARIANT in the Visual FoxPro COM type library. This new behavior matches that of the String type. For example, the following procedure appears in the COM type library with the return type of BSTR:

    PROCEDURE myProc( ) AS Character
    

Hand Pointer Setting for MousePointer Property

You can specify that the mouse pointer becomes the shape of a hand when you move the mouse over a control by setting the MousePointer property to a value of 15. For more information, see MousePointer Property. On Visual FoxPro applications running on Windows NT 4.0 operating systems, an arrow appears instead of a hand.

MaxLength Property Available for ComboBox Controls

You can now set the MaxLength property for ComboBox controls in addition to EditBox and TextBox controls. For more information, see MaxLength Property.

Language Support for Caption Expressions

The DBGETPROP( ) Caption field property for tables and views supports expressions as field captions. For more information, see the tables listing the field properties for tables and views in the DBGETPROP( ) Function.

Note   Support for using expressions as field captions should be used only with DBC tables in applications running on Visual FoxPro 8.0 or later. In earlier versions, the expression appears as a string literal.

You can retrieve a field caption as stored in a database container (DBC) using the FIELD( ) function. For more information, see FIELD( ) Function.

Changing the Background Color of the CommandButton Control

You can now specify the background color of text and graphics in an available or unavailable command button by setting the BackColor and DisabledBackColor properties for the CommandButton control. These two properties exist for other Visual FoxPro controls. For more information, see BackColor, ForeColor Properties, and DisabledBackColor, DisabledForeColor Properties.

Displaying Images in a Column Header

You can now display images in a column header by setting the Picture property for a column Header object. Turning Themes on or off affects the appearance of the image. The Picture property exists for other Visual FoxPro controls.

For more information, see Picture Property and Themes Property.

ToolTipText and StatusBarText Properties for All Visual Controls

You can now set the ToolTipText and StatusBarText properties for all visual controls including the OptionGroup, CommandGroup, Line, Control, Container, PageFrame, OleBoundControl, Column, Header, Image, and Label controls.

For more information, see ToolTipText Property and StatusBarText Property.

Refresh Method for Label and Shape Controls

You can now use the Refresh method to update the values in and redraw the Label and Shape controls. When you call the Refresh method for a Label control, Visual FoxPro updates the Caption property and redraws the label. When you call Refresh for a Shape control, Visual FoxPro redraws the shape. For more information, see Refresh Method.

Providing Multiple Configuration Files

You can use an external configuration file in addition to an internal configuration file in circumstances where you need to configure settings separately. For example, setting SCREEN=OFF should be performed in an internal configuration file.

When starting Visual FoxPro, you can use the default configuration file from the following locations in order:

  • Current working directory
  • Directory where Visual FoxPro is installed
  • Directories listed in the DOS path

You can set Visual FoxPro to read an external configuration file following an internal configuration file by using the new ALLOWEXTERNAL directive in the internal configuration file. When you include the setting ALLOWEXTERNAL=ON in the internal configuration file, Visual FoxPro searches for an external configuration file, usually Config.fpw, and reads its settings. You can also specify a different configuration file using the -C command-line switch when starting Visual FoxPro.

Note   For .exe and .dll file servers, Visual FoxPro supports only configuration files that are bound inside the server. Therefore, Visual FoxPro disregards the ALLOWEXTERNAL setting.

For more information about command-line switches, see Using Command-Line Options When Starting Visual FoxPro.

The settings in an external configuration file take precedence over those in the internal configuration file, if duplicate settings exist, because the external configuration file is read after the internal file. Visual FoxPro does not begin initialization until it reads both files.

If you want to specify the configuration file as read-only, place the file in your project and mark it as Included. If you want to specify that the file can be modified, place the file in your project and mark it as Excluded. You can then distribute the file separately with your application or executable file. By convention, configuration files use the .fpw extension.

For more information, see Special Terms for Configuration Files and Setting Configuration Options at Startup.

You can suppress the display of data-related messages in the Visual FoxPro status bar by using the new CURSOR keyword in the SET NOTIFY command. These messages include those relating to aliases, data sources, record pointers, record counts, exclusive status, and record locking status.

For more information, see SET NOTIFY Command.

SYS(2007) Returning Checksum Values Greater Than 16 Bits

You can now generate checksum values greater than 16 bits for large strings when using SYS(2007) - Checksum Value. Visual FoxPro includes a complementary function, SYS(2017) - Record Checksum Value, that calculates a checksum value based on the current record in the current work area. For more information, see SYS(2007) - Checksum Value and SYS(2017) - Record Checksum Value.

Removing White Space from Text Merges

You can specify how any white space appearing before each line in a text merge should be removed from the result by using the PRETEXT clause in the TEXT...ENDTEXT command. By providing the PRETEXT clause, Visual FoxPro improves its support for XML and Web services and provides better integration and manipulation of XML in Visual FoxPro code. For more information, see TEXT ... ENDTEXT Command.

Updating an Existing Object with Values from Current Record Using SCATTER...NAME

You can update the properties of an existing object specified by ObjectName with values from the current record by using the ADDITIVE keyword in the NAME clause of the SCATTER command. For more information, see SCATTER Command.

Specifying an Object when Inserting a New Table Record Using SQL INSERT Command

You can now insert a new record into a table with fields matching the properties of an object that you can specify using the new FROM NAMEObjectName clause in the SQL INSERT command. For more information, see INSERT - SQL Command.

Hiding Columns

You can hide grid columns by setting the Visible property for a column to False (.F.). For more information, see Column Object.

CLEAR DEBUG Resets Debugger Windows When Open and Clears All Breakpoints

Previously, the CLEAR DEBUG command did not clear all breakpoints in the Debugger. CLEAR DEBUG now clears all breakpoints automatically.

When the Debugger is open, Visual FoxPro clears all breakpoints and restores the Debugger windows to their default positions. When the Debugger is closed, Visual FoxPro opens the Debugger with the Debugger windows in their default positions.

For more information, see CLEAR Commands.

Suspending Program Execution Until a Windows Event Occurs

You can pause program execution until a Windows event occurs, such as moving the mouse, by using the new FORCE keyword with the DOEVENTS command. For more information, see DOEVENTS Command.

Checking for Hidden or System Files and Directories

You can check for hidden or system files and directories by using the new nFlags parameters in the FILE( ) and DIRECTORY( ) functions. You can also use the CD and CHDIR commands to switch to hidden files and directories. For more information, see FILE( ) Function, DIRECTORY( ) Function, and CD | CHDIR Command.

Retrieve Container Object Reference in Context with Current Code Editing Window

Visual FoxPro adds the value of 3 as a possible parameter for the ASELOBJ( ) function when you want to retrieve the container object reference in context with the currently active code editing window. For more information, see ASELOBJ( ) Function.

Specify Name and Location of Mapping Schema for XMLUPDATEGRAM( ) Function

Visual FoxPro includes the cSchemaLocation parameter in the XMLUPDATEGRAM( ) function so you can specify the name and location of mapping schema that you provide. For more information, see XMLUPDATEGRAM( ) Function.

See Also

Language Enhancements | Interactive Development Environment (IDE) Enhancements | Data Features Enhancements | Miscellaneous Enhancements | Behavior Changes Since Visual FoxPro 7.0