JavaScript Editor js editor     Web development 

Main Page

Visual FoxPro contains the following enhancements to classes, forms, controls and object-oriented related syntax.

Anchoring Visual Controls

You can anchor a visual control to one or more edges of its parent container using the control's Anchor property. When you anchor a visual control to the parent container, the edges of the control remain in the same position relative to the edges of the container when you resize the container. For more information, see Anchor Property.

Docking Forms

Visual FoxPro extends docking support to user-defined forms. Docking forms works similarly to docking toolbars except that you can dock forms to Visual FoxPro Interactive Development Environment (IDE) windows and other forms, and controls on the form can still obtain focus when the form is docked.

Visual FoxPro includes the following new and updated properties, methods, and events to support docking forms.

For more information, see How to: Dock Forms.

CheckBox and OptionButton Controls Support Wordwrapping

The WordWrap property is now supported for CheckBox and OptionButton controls. The text portions of these controls now use wordwrapping. For more information, see WordWrap Property.

CommandButton Controls Can Align Text with Pictures

The Alignment property now applies to CommandButton controls when specifying an image for the Picture property and setting the PicturePosition property to a value other than the default. The Alignment property also contains new and revised settings for CommandButton, CheckBox, and OptionButton controls. For more information, see Alignment Property.

CommandButton, OptionButton, and CheckBox Controls Can Hide Captions

The PicturePostion property contains a new setting of 14 (No text) for CommandButton, OptionButton, and CheckBox controls. You can use this setting to hide the text portions of these controls without needing to set the Caption property to an empty string. This setting is particularly useful when you want to include a hotkey for a button with a graphic without displaying the Caption text. You must set the Style property to 1 (Graphical) for this new setting to apply.

In addition, the PicturePosition property now applies to CheckBox and OptionButton controls when Style is set to 1 (Graphical).

For more information, see PicturePosition Property.

PictureMargin and PictureSpacing Properties Control Spacing and Margins on CommandButton, OptionButton, and CheckBox Controls

You can better control positioning of images on CommandButton, OptionButton, and CheckBox controls with the new PictureMargin and PictureSpacing properties. The PictureMargin property specifies margin spacing in pixels between an image and the control's border as determined by the PicturePosition property. The PictureSpacing property specifies margin spacing in pixels between an image and text on the control.

For more information, see PictureMargin Property and PictureSpacing Property.

Collection Objects Support in ComboBox and ListBox Controls

You can now specify Collection objects as the row source and row source type for the RowSource and RowSourceType properties of ComboBox and ListBox controls. For more information, see RowSource Property and RowSourceType Property.

Setting Ascending or Descending Indexes on Cursors in the DataEnvironment

You can specify ascending or descending order for a cursor index by using the new OrderDirection property for Cursor objects.

OrderDirection is disregarded when the cursor's Order property is empty.

For more information, see OrderDirection Property.

Grid Supports Rushmore Optimization

The Grid Control can be set to support Rushmore optimization if the underlying data source contains indexes that support this.

For more information, see Optimize Property.

Mouse Pointer Control for Grid Columns and Column Headers

The MousePointer and MouseIcon properties now apply to Column objects in a grid and Header objects in a column. For the MousePointer property, you can specify the new setting of 16 (Down Arrow) to reset the mouse pointer for a column header to the default down arrow.

For more information, see MousePointer Property and MouseIcon Property.

Rotating Label, Line, and Shape Controls

You can use the new Rotation property to rotate Label controls. The Rotation property applies to Line and Shape controls when used with the new PolyPoints property. For more information, see Rotation Property (Visual FoxPro), PolyPoints Property, and Creating More Complex Shapes using the PolyPoints Property.

Label Controls Can Display Themed Background

For Label controls, you can set the Style property to Themed Background Only to show only themed background colors when Windows themes are turned on. The label background color is the same as the parent container for the label. For more information, see Style Property.

ListBox Controls Can Hide Scroll Bars

You can use the new AutoHideScrollBar property for ListBox controls to hide scroll bars when the list contains less than the number of items that can be visible in the list box. For more information, see AutoHideScrollBar Property.

Toolbar Controls Can Display Horizontal Separator Objects

For Separator objects, set the Style property to 1 to display a horizontal line or a vertical line, depending on how the toolbar appears. If the toolbar appears horizontally, the line displays vertically. If the toolbar appears vertically, the line displays horizontally. In versions prior to this release, setting Style to 1 displayed a vertical line only.

In versions prior to this release, undocked vertical system and user-defined toolbars did not display horizontal separators. In the current release, horizontal separators now display for vertical undocked toolbars.

For more information, see Style Property.

Toolbar Controls Can Hide Separator Objects

The Visible property now applies to Separator objects so you can control whether a Separator object displays in Toolbar controls. When used in combination with the Style property, the separator's Visible property determines whether a space or line displays as the separator when its Style property is set to 0 (Normal - do not display a line) or 1 (display a horizontal or vertical line), respectively.

For more information, see Visible Property (Visual FoxPro).

Creating More Complex Shapes

You can use the new PolyPoints property for Line and Shape controls to create polygon lines and shapes. PolyPoints specifies an array of any dimension containing coordinates with the format of X1, Y1, X2, Y2, ..., organized in the order in which the polygon line or shape is drawn.

For Line controls, when you create a polygon line using the PolyPoints property, you can specify the new setting of "S" or "s" for the LineSlant property to create a Bezier curve.

For more information, see PolyPoints Property and LineSlant Property.

ComboBox Controls Can Hide Drop-Down Lists

You can now use the NODEFAULT command in the DropDown event for a ComboBox control. This will prevent the drop-down list portion of a ComboBox control from appearing. For more information, see NODEFAULT Command.

NEWOBJECT(В ) Creates Objects without Raising Initialization Code

To mimic the behavior of a class opened in Class Designer or Form Designer, pass 0 to the cInApplication parameter. This feature allows you to create design-time tools that view the structure of a class.

By passing 0 to the cInApplication parameter for the NEWOBJECT(В ) function, Visual FoxPro allows you to create an instance of a class without raising initialization code (such as code in the Init, Load, Activate, and BeforeOpenTables events). Furthermore, when the object is released, it does not raise its destructor code (such as code in the Destroy and Unload events). Only initialization and destructor code is suppressed; code in other events and methods is still called.

If you use the cInApplication parameter to suppress initialization and destructor code in an object, you also suppress it in the object's child objects.

This behavior is not supported for the NewObject Method.

For more information, see NEWOBJECT( ) Function.

Specify Where Focus is Assigned in the Valid Event

To direct where focus is assigned, you can use the optional ObjectName parameter in the RETURN command of the Valid event. The object specified must be a valid Visual FoxPro object. If the specified object is disabled or cannot receive focus, then focus is assigned to the next object in the tab order. If an invalid object is specified, Visual FoxPro keeps the focus at the current object.

You can now set focus to objects in the following scenarios:

  • Set focus to an object on another visible form.

  • Set focus to an object on a non-visible Page or Pageframe control.

For more information, see Valid Event and RETURN Command.

TextBox Controls Have Auto-Completion Functionality

You can add auto-completion functionality to your text box controls to make data entry more efficient. Auto-completion is the automatic display of a drop-down list of entries that match the string as it is typed into the text box. The entries come from a special table that tracks unique values entered into the text box, the control name that is the source of the value, and usage information.

The following properties support auto-completion:

By the setting the AutoComplete property, you determine the sort order for the entries. If you want more control over the list and where it is stored, you can use the AutoCompSource property to specify the table used to populate the automatic list. By default, the table is AUTOCOMP.DBF. You can use one table for each text box control or a single table can populate automatic lists for several text boxes.

If you use a single table, which is the default, the table uses values in the Source field for each entry to identify the text box control associated with the entry. By default, the Source field value is the name of the text box control. You can specify the Source field value using the AutoCompSource property of the text box. For example, you might want to make the same set of entries available to multiple Text box controls within the application such as address information. You can explicitly set the AutoCompTable and AutoCompSource properties for each of the controls to the same table and source field value. The same automatic list appears for each of them.

The text box control handles updating the auto-completion table for you based on the values actually entered in the text box. If you want to remove a value from the list, enter a string in a text box that matches the string you want to delete to filter the list for it. Select the entry in the list and press the DELETE key. The string remains in the table but no longer appears in the automatic list.

You can control the number of items that appear in the drop-down list using SYS(2910) - List Display Count.

For more information, see AutoComplete Property, AutoCompSource Property, and AutoCompTable Property.

New InputMask and Format Property Settings

The following new InputMask and Format settings are available:

InputMask Property

cMask Description


Permits alphabetic characters only and converts them to uppercase (A - Z).


Permits alphabetic characters only and converts them to lowercase (a - z).

Format Property

cFunction Description


Displays the value as blank if it is 0, except when the control has focus.

Dates are also supported in these controls. The / / date delimiters are not displayed unless the control has focus.

For more information, see InputMask Property and Format Property.

Use PictureVal Property to Pass Images as Strings

The Image control's new PictureVal property can be used instead of the Picture Property (Visual FoxPro) to specify a character string expression or object of an image. For an object, the format must be of an IPicture interface format compatible with LOADPICTURE( ) Function.

For more information, see PictureVal Property.


The CLEAR CLASSLIB command now automatically executes a CLEAR CLASS command on each class in the specified class library. Any errors that might occur during release of individual classes (e.g., class in use) are ignored.

Classes in other class libraries that are used or referenced by a class in the specified class library are not cleared.

For more information, see CLEAR Commands.

Screen Resolution Limit Increased

In prior versions of Visual FoxPro, the definable maximum area for a form is limited to twice the Screen Resolution for both X and Y dimensions. For example, if your monitor resolution is 1280x1024, then the max dimensions would be:

В Copy Code
Form.Width = 2552
Form.Height = 2014

Additionally, if you attempted to set Width and Height properties to these limits in design-time and then ran the form, you would see that the values have reverted to screen resolution limits (being that they were saved this way):

В Copy Code
Form.Width = 1280
Form.Height = 998

In Visual FoxPro 9.0, this limitation has been increased to approximately 32,000 pixels for each dimension and now allows for more flexibility with certain forms such as scrollable ones:

В Copy Code
Form.Width = 32759
Form.Height = 32733

For more information, see Width Property and Height Property.

ProjectHook Source Code Control Events

New events have been added to the ProjectHook class, which allow you to perform source code control operations such as check-in and check-out of multiple files at once.

For more information, see SCCInit Event and SCCDestroy Event.

AddProperty Method Supports Design Time Settings

You can specify the visibility (Protected, Hidden or Public) and description of a property using the AddProperty method with new available parameters. These settings can also be controlled from the New Property Dialog Box and Edit Property/Method Dialog Box. For more information, see AddProperty Method.

WriteMethod Method Supports Design Time Settings

You can specify the visibility (Protected, Hidden or Public) and description of a method using the WriteMethod method with new available parameters. These settings can also be controlled from the New Property Dialog Box and Edit Property/Method Dialog Box. For more information, see WriteMethod Method.

See Also

JavaScript Editor js editor     Web development