Partager via


Controls and Objects Created in Earlier Versions

This topic describes support for controls and objects created in earlier FoxPro versions and new controls added to Visual FoxPro.

The easiest way to create controls and objects is by using the Form Designer. For more information about creating controls with the Form Designer, see Creating Forms.

You can also create controls and objects programmatically. See DEFINE CLASS for more information about creating controls programmatically from the Visual FoxPro base classes, and Object-Oriented Programming.

Some controls behave slightly differently depending on whether you are using Visual FoxPro for Windows or Visual FoxPro for Macintosh; by default, controls in Visual FoxPro for Macintosh follow user interface conventions common to Macintosh applications. For example, by default the CheckBox, ComboBox, and OptionButton controls cannot receive the focus in Visual FoxPro for Macintosh. For more details about differences in control behavior, see the topic for the SET KEYCOMP command.

In Visual FoxPro, a NAME clause has been added to each of the controls created in previous FoxPro versions. The NAME clause creates an object reference for controls created with @ ... GET and @ ... EDIT, allowing you to manipulate the controls with Visual FoxPro properties, events, and methods. The NAME clause provides an intermediate step to upgrade your applications using Visual FoxPro object-oriented programming techniques.

Compatibility with FoxPro 2.x Controls

The following table lists the controls available in earlier FoxPro versions and the base class you can use to programmatically create the same control in Visual FoxPro.

FoxPro 2.x controls Equivalent VisualFoxPro controls Visual FoxProbase class names
@ ... GET - Check Boxes CheckBox Control CheckBox
@ ... GET - Lists ListBox Control ListBox
@ ... GET - Popups ComboBox Control ComboBox
@ ... GET - Push Buttons CommandButton Control CommandButton
@ ... GET - Radio Buttons OptionButton Control OptionButton
@ ... GET - Spinners Spinner Control Spinner
@ ... GET - Text Boxes TextBox Control TextBox
@ ... EDIT - Text Edit Regions EditBox Control EditBox

Visual FoxPro Base Classes

In addition, the following controls and objects are new to Visual FoxPro and can be created programmatically only from their Visual FoxPro base classes.

Controls and objects Base class names Description
Column Object Column Creates a column in a grid.
CommandGroup Control CommandGroup Creates a group of command buttons.
Container Object Container Creates an object that can contain other objects.
Control Object Control Creates a control object that can contain other protected objects.
Cursor Object Cursor Created when a table or view is added to the data environment for a form, form set, or report.
Custom Object Custom Creates a custom, user-defined object.
DataEnvironment Object DataEnvironment Created when a form, form set, or report is opened.
Form Object Form Creates a form.
FormSet Object FormSet Creates a form set.
Grid Control Grid Creates a Grid control.
Header Object Header Creates a Header for a Column in a Grid.
Hyperlink Object HyperLink Creates a hyperlink object, allowing you to jump to a URL (Uniform Resource Locator).
Image Control Image Creates an Image control that displays a .bmp or PICT picture.
Label Control Label Creates a Label control that displays text.
Line Control Line Creates a Line control that displays a horizontal, vertical, or diagonal line.
OLE Container Control OLEControl Creates an OLE Container control.
OLE Bound Control OLEBoundControl Creates an OLE Bound control.
OptionGroup Control OptionGroup Creates a group of option buttons.
Page Object Page Creates a page in a page frame.
PageFrame Control PageFrame Creates a page frame to contain pages.
ProjectHook Object ProjectHook Instantiated whenever a project is opened, providing programmatic access to project events.
Relation Object Relation Created when you establish relationships from within the Data Environment Designer for a form, form set, or report.
Separator Object Separator Creates a Separator object that places space between controls in a toolbar.
Session Object Session Creates a custom, user-defined object that manages its own data session.
Shape Control Shape Creates a Shape control that displays a box, circle, or ellipse.
Timer Control Timer Creates a Timer control that can execute code at regular intervals.
ToolBar Object Toolbar Creates a toolbar on which controls can be placed.

See Also

CREATE CLASS | CREATE FORM | DEFINE CLASS