Dela via


Behavior Changes Since Visual FoxPro 7.0

Visual FoxPro includes behavior that differs from previous versions and might affect existing code. These behavior changes are organized according to the following categories:

  • Critical Changes   Behavior changes most likely to affect existing code when running under Visual FoxPro 8.0. It is extremely important that you read this section.
  • Important Changes   Behavior changes that might affect existing code when running under Visual FoxPro 8.0.
  • Miscellaneous Changes   Behavior changes you should know about but are not likely to impact existing code.
  • Removed Items   Features or files that previously existed in prior versions of Visual FoxPro.

Critical Changes

Critical behavior changes will most likely to affect existing code when running under Visual FoxPro 8.0. It is extremely important that you read this section.

SQL Data Engine

Visual FoxPro contains a new SET ENGINEBEHAVIOR command so that you can control SQL data engine compatibility. This impacts how SQL SELECT commands function. The current default behavior can be set to previous behavior using the SET ENGINEBEHAVIOR command and is described as follows:

  • You cannot use the DISTINCT clause with Memo or General fields in a SQL SELECT statement. Instead, wrap a Memo field expression inside a function such as PADR( ) or ALLTRIM( ).

  • The GROUP BY clause does not support Memo or General fields.

    The GROUP BY clause must list every field in the SELECT list, except for fields contained in an aggregate function, such as the COUNT( ) function. In addition, the GROUP BY clause must also list every field in a HAVING clause, except for fields contained in an aggregate function.

  • A SQL SELECT statement can contain the HAVING clause without the GROUP BY clause, as long as the SQL SELECT statement does not contain any aggregate functions.

  • SQL SELECT statements do not automatically remove trailing spaces from the values that are compared using the LIKE operation. In versions prior to Visual FoxPro 8.0, both values in the LIKE operation were trimmed from the right prior to evaluation so that the LIKE operation could not possibly report all the correct matches.

For more information, see SELECT - SQL Command and SET ENGINEBEHAVIOR Command.

Support for Automatically Incrementing Field Values

Visual FoxPro contains the new Integer (AutoInc) field type. The AFIELDS() function now returns 18 columns instead of 16 due to new support for autoincrementing field values. Column numbers 17 and 18 now specify the NextValue and Step fields, which contain values of Numeric (integer) type. For more information, see AFIELDS( ) Function.

The COPY STRUCTURE EXTENDED command adds the numeric FIELD_NEXT and FIELD_STEP fields to support autoincrementing. For more information, see COPY STRUCTURE EXTENDED Command.

Enabled Windows XP Themes Support by Default

Visual FoxPro contains and enables support for Windows XP Themes by default in your applications. The new Themes property for visual classes can affect your existing user interface when using Microsoft Windows XP. You can turn this support off by setting the Themes property at the control, form, or _SCREEN system variable level, or using the SYS(2700) - Enables Windows XP Themes function.

Though existing applications should appear fine with Themes, controls defined using @...GET or @...SAY and similar @... commands are not compatible with Windows XP Themes. Therefore, when running programs written with FoxPro 2.x on Windows XP or later, you should set the _SCREENThemes property to False (.F.); otherwise, the controls on the forms disappear.

You also might need to make minor modifications to forms that contain PageFrame objects. The Themes property provides a gradient effect on Page objects, so a label, option button, or similar control with text does not appear correctly if the BackStyle property of the control is set to Opaque. You can remedy this situation by setting BackStyle to Transparent.

When Themes are enabled, you should avoid using the CLEAR COMMAND for forms because it might cause paint issues with themed controls, such as command buttons, that have mouse hovering effects.

For a Grid control, Themes affects the visual appearance of column headers. If themes are enabled for a grid, the BackColor and ForeColor properties of the header are disregarded because they inherit the attributes of the theme. However, the BackColor and ForeColor properties of a Column object display independently from the setting of a grid's Themes property. A subclassed grid now respects the Column and HeaderForeColor and BackColor properties of its parent.

For more information, see Themes Property and SYS(2700) - Enables Windows XP Themes.

Visual FoxPro OLE DB Provider

  • Visual FoxPro OLE DB Provider implements more compatibility with .NET such as working with Command Builder.
  • The Visual FoxPro OLE DB Provider recognizes any valid Config.fpw file placed in the same directory as the Provider to increase MVCOUNT, which sets the maximum number of variables that Visual FoxPro can maintain. For more information, see Special Terms for Configuration Files.
  • When setting the connection string for the Visual FoxPro OLE DB Provider, you can specify an existing Visual FoxPro ODBC Data Source Name (DSN) instead of a data source. The provider uses the data source indicated in the DSN and expands it to an appropriate provider connection string.
  • The GETENV( ) function is no longer supported in the Visual FoxPro OLE DB Provider.
  • You cannot query the value of ANSI using the SET command. However, the SET ANSI and SET MULTILOCKS commands remain supported.

Grid Behavior

The following changes affect grids:

  • Resizing grid column headers no longer calls the HeaderClick event. This change affects the column separator.
  • Setting the ColumnVisible property to False (.F.) hides the column. In prior versions, this setting caused the column to appear empty.
  • The GridRefresh method visually updates the grid's record indicator even if the grid does not have focus.

Active Document Support

Visual FoxPro no longer supports Active Documents. The ActiveDoc class still exists in the Visual FoxPro language and can be instantiated. However, the functionality of hosting a Visual FoxPro application inside Internet Explorer is no longer available for security reasons.

Important Changes

Important changes might affect existing code when running under Visual FoxPro 8.0.

Syntax Validation for Views

In prior versions of Visual FoxPro, you could create a new view that contained syntax errors. Visual FoxPro now validates views to ensure no syntax problems exist.

For example, suppose you included a memory variable as part of the view definition. In previous versions, the memory variable did not need to exist when the view was created because Visual FoxPro did not perform syntax checking. Now, the memory variable must exist.

Form Deactivates When Clicking Visual FoxPro Desktop

Clicking the Visual FoxPro desktop causes the form's Deactivate event to occur and deactivates an active user form. This improvement provides better integration with the new BINDEVENT( ) function for activating and deactivating forms.

XMLTOCURSOR( ) Function

Visual FoxPro 7.0 Service Pack 1 included flag 8192 for XMLTOCURSOR( ) so you can specify importing of a specified XML file into an existing table or cursor. For more information, see XMLTOCURSOR( ) Function.

XMLTOCURSOR( ) converts a Decimal data type to Numeric 20,19 (width, precision). In Visual FoxPro 7.0, this mapped to Numeric 8,0.

TABLEUPDATE( ) Function Behavior When Setting BatchUpdateCount Property to a Value Greater Than 1

Avoid setting BatchUpdateCount to a value greater than 1 when you are updating data, using Table Buffering, and updating the table or tables in the data source from multiple clients. In this scenario, TABLEUPDATE( ) always returns True (.T.).

Due to the way that Open Database Connectivity (ODBC) behaves, Visual FoxPro is unable to detect conflicts when no error is generated by the server, yet nothing is updated, for example, no row matches the WHERE clause. This can occur when you use WhereType set to DB_KEYANDUPDATABLE, DB_KEYANDMODIFIED, or DB_KEYANDTIMESTAMP, and another user has changed one of the underlying values in the WHERE clause such that the row is not found by the update statement.

You can safely set BatchUpdateCount to a value greater than 1 for INSERT, DELETE, and UPDATE operations when FORCE is True.

Opening or Closing Offline Views Within a Transaction

Due to issues related to offline views and transactions, you cannot open or close an offline view within a transaction when using USESQLViewName in ADMIN/ONLINE mode. For more information, see the descriptions for the ADMIN and ONLINE keywords in the USE Command.

Implicit Conversion of Object References to a String

Visual FoxPro converts an object reference to the string, "(Object)", when used with the following language elements:

  • TRANSFORM( ) function
  • MESSAGEBOX( ) function
  • DEBUGOUT command
  • WAIT WINDOW command
  • ? command

This behavior applies to all native Visual FoxPro objects and COM objects. The object reference must actually exist. For more information, see TRANSFORM( ) Function, MESSAGEBOX( ) Function, DEBUGOUT Command, WAIT Command, and ? | ?? Command.

Reloading Changes in the View Designer

If the View Designer cannot reload your changes after you make changes in the View SQL window, a dialog box appears and asks the following:

"View/Query designer is unable to reload your changes. Would you like to rebuild content from the designer?"

If you select Yes, your changes are discarded in the SQL window, and Visual FoxPro returns you to the View Designer. If you select No, Visual FoxPro returns you to the SQL window.

To save a statement that cannot be parsed such as a call to a stored procedure, select No and click the Save button on the toolbar. Visual FoxPro saves the query. You can also click the Save button after entering the command in the SQL window to save the query. You do not need to click the View Designer window, which causes the View Designer to try to load and parse the query.

SET DATABASE TO Accepts an Empty String

Using the SET DATABASE command with an empty string previously generated an error that the database was not open. You can now use SET DATABASE TO "", and it behaves the same as calling SET DATABASE TO without parameters. For more information, see SET DATABASE Command.

HOME(5)

HOME(5) now returns the Visual Studio MSDN directory instead of the Visual Studio MSDN Samples directory. Visual FoxPro no longer installs its samples with MSDN. Instead, Visual FoxPro samples are now stored on the source media or CD, and you can look up their locations using the Help that is installed with Visual FoxPro. For more information, see HOME( ) Function.

Displaying Fonts in Properties Window for FontName Property

In previous versions, multiple fonts from a single family were sometimes displayed. The Properties window properties list for the FontName property and the AFONT() function now include only the actual font families. For more information, see FontName Property and AFONT( ) Function.

CTRL+HOME and CTRL+END Keyboard Shortcuts

Visual FoxPro provides keyboard shortcut behavior consistent with Microsoft programs such as Excel and Access when navigating in a grid and using the BROWSE command:

  • Moves to the first record of a cursor or table in a grid and when using BROWSE by pressing CTRL+HOME.
  • Moves to the last record of cursor or table in a grid and when using BROWSE by pressing CTRL+END.

In prior versions of Visual FoxPro, CTRL+HOME opened a memo field, similar to CTRL+PAGE UP, and CTRL+END closed the Browse window, similar to CTRL+W.

For more information, see Keyboard Shortcuts.

Keyboard Shortcut Behavior for CTRL+TAB

Visual FoxPro supports context-sensitive behavior when pressing the CTRL+TAB key combination. However, when FormAllowTabs property is False (.F.), CTRL+TAB no longer exits an edit box. Instead, CTRL+TAB moves to the next available window. You can press the TAB key to exit an edit box when AllowTabs is False.

For more information, see Interactive Development Environment (IDE) Enhancements.

DISPLAYPATH( ) Function

The DISPLAYPATH( ) function now returns title (proper) case instead of all lowercase.

Calling DODEFAULT( ) Function in Base Classes

Calling the DODEFAULT( ) function in a method that does not exist in the parent class does not produce errors. However, this behavior still produces the following results:

  • Visual FoxPro disregards any parameters that are passed because no code is executed.
  • Visual FoxPro always returns True (.T.), which is the default behavior for any procedure without an explicit RETURN statement.

This behavior affects the following scenarios:

  • Custom methods that are defined in a class
  • Native methods that are Hidden in the parent class

For more information, see DODEFAULT( ) Function.

Using DOEVENTS as a Function

You can no longer call the DOEVENTS command using parentheses, for example, DOEVENTS( ). The DOEVENTS command now supports the optional FORCE keyword. For more information, see DOEVENTS Command.

COM Server Typing for Character Types

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

For more information, see DEFINE CLASS Command.

QUARTER( ) Function

The QUARTER( ) function now returns 0 if passed an empty Date or DateTime value, for example, QUARTER({//}). In prior versions of Visual FoxPro, this generated an error message.

Trapping Errors in Reports

You can now trap the following errors that were previously handled by the system error handler:

  • Errors that occur in reports
  • Errors due to tables with bad database back links

Miscellaneous Changes

The following are miscellaneous changes that you should know about but are not likely to impact existing code.

Default Instancing Setting for EXE Servers

When you create a new project containing OLEPUBLIC classes, Visual FoxPro defaults the Instancing setting in the Servers tab of the Project Information dialog box to Single Use. The Single Use setting is appropriate for building EXE servers.

When you create a Visual FoxPro dynamic-link library (.dll) COM Server, Visual FoxPro defaults the Instancing setting to Multi Use.

Visual FoxPro retains any changes made to the Instancing setting.

For more information, see Servers Tab, Project Information Dialog Box.

Number of Rows for Exporting Data Cursors

Visual FoxPro raises the maximum from 16,384 to 65,535 rows when exporting a data cursor to an Excel spreadsheet. The new limit includes one row reserved for the field header. For more information, see EXPORT Command, COPY TO Command, and The Process of Exporting Data.

Docked Windows

The state and location of docked windows, such as the Command, View, and Debug windows, persist from the last user session. You can write your own layout schemes using the new DOCK WINDOW command. Deleting or editing the FoxUser.dbf resource file, which contains your settings, restores your default window settings. For more information, see Docking Windows and DOCK WINDOW Command.

When docking a link-docked container to the Visual FoxPro desktop, a container border no longer appears. Instead, only the docked windows appear.

Value Tips for Read-Only Properties and Inherited Methods and Events

Sometimes, you might have difficulty seeing the values for read-only properties or any visual class libraries from which methods and events are inherited in the Properties window properties list. You can now view value tips for these settings by moving the mouse over the property, event, or method in the properties list. For more information, see "Viewing Properties for Objects" in Manipulating Objects.

Wordwrapping for ToolTip Text

Visual FoxPro supports wordwrapping and increases the limit from 255 to 4,095 displayable characters for ToolTip text. For more information, see ToolTipText Property.

Windows-Style Open and Save Dialog Boxes

Visual FoxPro running on Windows 2000 and Windows XP operating systems includes the following changes in the Open, Save, and Open Picture dialog boxes:

  • A Places bar so you can navigate to common locations such as the My Documents folder and Desktop
  • The following options are available by clicking the View Menu icon: Thumbnails, Tiles, Icons, Lists, and Details. You can preview images in Windows 2000 and later by clicking Thumbnails. Visual FoxPro uses the Thumbnails view as the default setting to provide mini-previews of images. Therefore, the Open Picture dialog box no longer includes a frame for displaying an image. The Preview check box appears in the Open Picture dialog box only when running Visual FoxPro on operating systems earlier than Windows 2000.
  • The capability to resize dialog boxes

You can select multiple files in the Open dialog box after clicking Add in the Project Manager window to add a file to a project.

When you call the AGETCLASS( ) function, the Files of type list in the Open dialog box includes the program (.prg) file type. AGETCLASS( ) is no longer supported in Visual FoxPro runtime libraries because routines for parsing program (.prg) files are restricted to design time only.

For more information, see Open Dialog Box, Open Picture Dialog Box, Project Manager Window, and AGETCLASS( ) Function.

Maximum Form Design Area

The maximum design area of a new form in the Form Designer is now unlimited. The default setting for Maximum Design Area on the Forms tab in the Options dialog box is now None.

AGETCLASS( ) Function Not Supported in Visual FoxPro Run Time

AGETCLASS( ) is no longer supported in Visual FoxPro runtime libraries because routines for parsing program (.prg) files are restricted to design time only.

Increase for Default MVCOUNT

The default maximum number of variables that Visual FoxPro can maintain, which you can set using MVCOUNT in a configuration file, increases from 1,024 to 16,384.

Puzzle

You can now reactivate the Visual FoxPro puzzle by typing the following in the Command window:

ACTIVATE WINDOW Puzzle

Removed Items

Visual FoxPro no longer includes the following items:

  • Samples: Client/Server, ActiveDocs Solution, Gopher Server, Pool Manager Server, and TasTrade application. The TasTrade database remains in this release of Visual FoxPro.

  • Tools: Internet Search Wizard, CliReg32.exe, and Transformer.

    The source for Converter now resides in XSource.zip.

    The functionality for CliReg32.exe has been removed and has been replaced by the Component Services Tool, which is included with Windows 2000 and XP operating systems. You can use this tool to export a COM+ Server application for installation on one or more server computers. It also contains DCOM Config support that you can use to access remote applications. To access the Component Sevices Tool, click the Windows Start menu, then Control Panel, and double-click Component Services. For more information about Component Services, see the Windows online Help for the Component Services Tool.

  • ActiveX controls: FpOLE.ocx, FpOLE.dll, and FoxTLib.ocx, which is replaced with the TLibInf32 COM component.

  • ODBC driver and redistributable merge module: VfpODBC.msm

  • Functionality: Hosting for Active Documents, though Visual FoxPro retains the Active Documents class. Visual FoxPro does not include a Vfp8run.exe file because the support file is no longer distributed with Visual FoxPro.

See Also

What's New in Visual FoxPro 8.0 | Interactive Development Environment (IDE) Enhancements | Data Features Enhancements | Language Enhancements | Miscellaneous Enhancements