New Classes, Commands, and Functions
Visual FoxPro provides new classes, commands, functions, and system variables with the following features:
- Structured error handling using TRY...CATCH...FINALLY, THROW, and Exception class
- Collection class
- XMLAdapter, XMLTable, XMLField classes and other XML enhancements
- Binding events from native Visual FoxPro objects
- Defining and subclassing member classes
- Delayed control binding on forms using BindControls property
- Remote data connectivity using CursorAdapter class
- Automatic sizing and locking for Grid and Browse columns
- Highlighting for Grid rows and selected fields
- Position pictures relative to captions
- Controlling orientation of tabs on PageFrame controls
- Hyperlinks support for TextBox and EditBox controls
- Support for Windows XP Themes in all controls
- GDI+ image support (animated .gif files, RotateFlip property)
- Controlling font character sets on objects supporting fonts
- Support for docking windows and toolbars
- Centering check boxes within grid columns
- Displaying images in the text box portion of ComboBox controls
- Using grids as list boxes
- Empty class
- Firing events when moving items in a list box using the mover bar
- Adding and removing properties and values to objects at run time
- Searching for executable (.exe) applications along file paths
- Removing empty values where not supported
- Enabling accumulation of mouse wheel events in the event queue
- Choose SQL data engine compatibility prior or according to Visual FoxPro 8.0
- Allow default output to appear on a form
- Specify level of table validation to perform
- New XML Web services foundation classes
Structured Error Handling Using TRY...CATCH...FINALLY, THROW, and Exception class
You can now implement structured error and exception handling using the TRY...CATCH...FINALLY functionality, which includes the new Exception class, the THROW clause, and SYS(2410) - Error Handler function.
You can define and create a subclass of the Exception class, which is used for error and exception handling. Visual FoxPro generates exception objects automatically to store information about an error when it occurs in the TRY block of a TRY...CATCH...FINALLY error handling structure.
For more information, see Structured Error Handling, TRY...CATCH...FINALLY Command, Exception Class, and SYS(2410) - Error Handler.
Collection Class
You can use collections to create a set of related items. Collections offer a way to work with contained objects and use standard ways to access and iterate through items. For more information, see Collection Class.
XMLAdapter, XMLTable, XMLField Classes and Other XML Enhancements
Visual FoxPro adds the XMLAdapter, XMLTable, and XMLField classes to enhance its compatibility with XML DiffGram and ADO.NET DataSet formats and to support hierarchically formatted XML for the following:
- XML files that have a schema, either inline or external, associated with them and as implemented in ADO.NET DataSets
- Microsoft XML Data Reduced Schema (XDR) as used by Microsoft SQL-XML
- ADO Recordset schemas that are produced when an ADO Recordset is saved as XML to a file or stream
XMLAdapter is a "two-way" class. You can import XML and its contained schema to create tables, or you can create and generate XML from tables.
Note The XMLAdapter class requires Microsoft XML Core Services (MSXML) 4.0 Service Pack 1 (SP1) or later.
Visual FoxPro updates the STRCONV( ) function to support encoding and decoding hexBinary.
For more information, see XML Functionality Using XMLAdapters, Visual FoxPro and XML Schema Data Type Mapping, XMLAdapter Class, XMLTable Class, XMLField Class and STRCONV( ) Function.
Binding Events from Native Visual FoxPro Objects
Visual FoxPro extends event handling support for native Visual FoxPro objects by providing the BINDEVENT(), UNBINDEVENTS(), RAISEEVENT(), and AEVENTS() functions. For more information, see Event Binding for Visual FoxPro Objects.
Defining and Creating Subclasses for Member Classes
You can now define and create subclasses for certain member classes. These members and their parent containers include the following:
- Page and PageFrame
- CommandButton and CommandGroup
- OptionButton and OptionGroup
- Column and Grid
- Header and Column
Using member classes, you can define consistent behavior for all members of a specific class. For example, you can define a particular behavior in the Activate event of a Page class to be used in a specific PageFrame class or object. All member pages for that page frame inherit the same code or behavior.
The PageFrame, CommandGroup, OptionGroup, and Grid classes have two new properties, MemberClassLibrary and MemberClass, which you can use to set the default custom class for member objects. When these properties are set, new member objects inherit from the specified member class. Column objects have two new properties, HeaderClassLibrary and HeaderClass, which you can set to specify a custom Header class.
You can now edit and create a subclass of the Page class in the Class Designer. The CommandButton and OptionButton classes already exist in the Class Designer. However, the Class Designer does not include the Column and Header classes.
For more information, see Member Classes.
Delayed Control Binding on Forms Using BindControls Property
You can now specify when data binding occurs for data-bound controls by setting the BindControls property for Form objects. For more information, see BindControls Property.
Remote Data Connectivity Using CursorAdapter Class
Visual FoxPro provides improved remote data connectivity by including the new CursorAdapter class and adding the DataSource and DataSourceType properties to the DataEnvironment class. For more information about the CursorAdapter class, see Data Features Enhancements.
Automatic Sizing and Locking for Grid and Browse Columns
You can fit columns to data in grids and in Browse windows automatically by setting the AllowAutoColumnFit property and using the AutoFit method. For more information, see AllowAutoColumnFit Property, AutoFit Method, and Fitting Columns to Data Automatically.
You can lock columns using the BROWSE command with the LOCK clause or setting the GridLockColumns and LockColumnsLeft properties. For more information, see BROWSE Command, LockColumns Property, LockColumnsLeft Property, and Locking Columns.
Highlighting for Grid Rows and Selected Fields
You can control the color display for selected rows and items in TextBox controls in a grid by setting the HighlightForeColor, HighlightBackColor, SelectedItemBackColor, SelectedItemForecolor, and HighlightStyle properties.
Position Pictures Relative to Captions
You can position pictures relative to their captions by setting the PicturePosition property for the CommandButton, OptionButton, and CheckBox controls.
For more information, see PicturePosition Property.
Controlling Orientation of Tabs on PageFrame Controls
You can control where tabs display on a PageFrame control by setting the TabOrientation property. For more information, see TabOrientation Property.
Hyperlinks Support for TextBox and EditBox Controls
You can control whether hyperlinks are displayed and enabled within TextBox and EditBox controls by setting the EnableHyperlinks property. For more information, see EnableHyperlinks Property.
Support for Windows XP Themes in All Controls
You can now incorporate support for Windows XP Themes in applications running on Windows XP operating systems. Windows XP Themes is a new technology that controls a number of visual attributes for user interface elements, including the appearance of controls, border color and style, selection, and hover effects. For more information, see Themes Property, Style Property, and SYS(2700) - Enables Windows XP Themes.
GDI+ Image Support (Animated .gif Files, RotateFlip Property)
Visual FoxPro replaces native support for rendering Graphics Interchange Format (.gif) and Joint Photographic Electronic Group (.jpeg) formats with Graphics Device Interface+ (GDI+), the next generation graphics device interface for Microsoft Windows XP and future releases of the Windows operating system.
With GDI+, you can now rotate and invert, or flip, an image by setting the RotateFlip property on the Image control.
For more information, see Graphics Support in Visual FoxPro, RotateFlip Property, Picture Property, and Open Picture Dialog Box.
Controlling Font Character Sets on Objects Supporting Fonts
You can now control font character sets on every object that supports fonts by setting the FontCharSet property. For more information, see FontCharSet Property.
Support for Docking Windows and Toolbars
You can programmatically dock IDE tool windows and toolbars using the new DOCK WINDOW command. The new ADOCKSTATE() function returns the state of docked windows and toolbars. For more information, see Docking Windows, DOCK WINDOW Command, and ADOCKSTATE( ) Function.
Centering Check Boxes Within Grid Columns
You can align check boxes with the center of grid columns by setting the new Centered property for CheckBox controls using the following syntax:
CheckBox.Centered [= lExpr]
You can set Centered to the default value of False (.F.), which specifies no center alignment, or to True (.T.), which specifies aligning the check box with the center of the control boundaries. The Centered property works with the control's Alignment property, which aligns text, to determine on which side of a check box a caption appears. For more information, see Centered Property.
Displaying Images in the Text Box Portion of ComboBox Controls
In previous versions, images that accompanied entries in the list of a ComboBox control did not appear in the text box of the control when you selected an entry. You can optionally display an image in the text box of a ComboBox control and determine how the image appears by setting the PictureSelectionDisplay property.
For more information, see PictureSelectionDisplay Property.
Using Grids as List Boxes
You can mimic a list box using a grid by specifying whether users can select individual cells or must select the entire row by setting the GridAllowCellSelection property. Selecting individual cells or the entire row does not the change color of the selected row or cell. The KeyPress event now also applies to the Grid control.
For more information, see AllowCellSelection Property and KeyPress Event.
Empty Class
You can use the Empty class for working with business objects. An Empty object instantiates and releases quickly for optimized performance. An Empty object is typically used in the following scenarios:
- When adding properties to or removing properties from a running instance of the class using the ADDPROPERTY( ) and REMOVEPROPERTY( ) functions.
- When using the SCATTER...NAME command with the ADDITIVE clause to populate contents from the current record.
The Empty class contains no intrinsic properties, methods, or events. It cannot be subclassed. You can add custom properties only at run time using the ADDPROPERTY( ) function or SCATTER...NAME command with the ADDITIVE clause.
The Empty class is available only within a program (.prg) file. You cannot define an Empty class in a visual class library (.vcx) file.
For more information, see Empty Class.
Firing Events When Moving Items in a List Box Using the Mover Bar
You can specify certain behavior such as canceling the movement of an item when you move an item up or down in a ListBox control with the mover bar using the mouse, keyboard, or programmatically with the new OnMoveItem event. OnMoveItem fires after selecting and moving the item and after every subsequent move but before the list box displays the item movement. For more details, see OnMoveItem Event.
You can programmatically move items to new positions in the list box using the new MoveItem method. For more details, see MoveItem Method.
Adding and Removing Properties and Values to Objects at Run Time
At run time, you can now dynamically add and remove properties and their values from any valid Visual FoxPro object, including created from Visual FoxPro classes, COM class, or those created by the SCATTER...NAME command. For more information, see ADDPROPERTY( ) Function and REMOVEPROPERTY( ) Function.
Searching for Executable (.exe) Applications Along File Paths
Customers that run custom Visual FoxPro applications that access data and resources over networks might sometimes experience performance degradation when the application searches the network for a function, procedure, executable file, and so on, inside another application.
You can now specify that Visual FoxPro search within an application for a specific procedure or user-defined function (UDF) before it searches along the SET DEFAULT and SET PATH locations. By doing so, you can improve performance for applications that run on a local or wide area network. For more information, see SYS(2450) - Application Search Path Order and DO Command.
Removing Empty Values Where Not Supported
You can return an appropriate substitute value instead of an empty value, such as False (.F.) or 0, from two expressions. You can use this functionality to remove empty values from calculations or operations where empty values are not supported or relevant. For more information, see EVL( ) Function.
Enabling Accumulation of Mouse Wheel Events in the Event Queue
Usually, to smooth mouse wheel scrolling, Visual FoxPro accumulates mouse wheel events. With faster computers, it is not as critical to accumulate mouse wheel events, which can prevent proper implementation of the System Tray (Taskbar Notification Area) Foundation Class. You can now choose to whether to enable the accumulation of mouse wheel events in the event queue using the new SYS(2060) - Mouse Wheel Events function.
Choose SQL Data Engine Compatibility Prior or According to Visual FoxPro 8.0
You can now specify that Visual FoxPro execute SQL SELECT commands as performed prior or according to Visual FoxPro 8.0. This makes it possible for you to maintain backwards compatibility for applications that use the SQL data engine prior to Visual FoxPro 8.0. For more information, see SYS(3099) - SQL Data Engine Compatibility Mode and SET ENGINEBEHAVIOR Command.
Allowing Default Output to Appear on a Form
You can set the new FormAllowOutput property to determine whether default output appears on a form. For more information, see AllowOutput Property.
Specify Level of Table Validation to Perform
You can use the SET TABLEVALIDATE command when you want a lower level of table integrity checking than the default setting. For more information, see SET TABLEVALIDATE Command.
New XML Web Services Foundation Classes
Visual FoxPro replaces the _WebServices.vcx and _WebServices.vct Foundation Class libraries with the _ws3Utils.vcx and _ws3Client.vcx Foundation Class libraries. These new class libraries use SOAP Toolkit 3.0. For more information, see XML Web Services Foundation Classes.
See Also
Language Enhancements | Interactive Development Environment (IDE) Enhancements | Data Features Enhancements | Miscellaneous Enhancements | Behavior Changes Since Visual FoxPro 7.0