Freigeben über


@ ... CLASS Command

Creates a control or object that can be activated with READ.

@ nRow, nColumn CLASS ClassName NAME ObjectName

Parameters

  • @ nRow, nColumn
    Specifies the position of the control or object. The height and width of the control or object is determined by the class default height and width values.

    Rows are numbered from top to bottom. The first row is number 0 in the main Visual FoxPro window or in a user-defined window. Row 0 is the row immediately beneath the Visual FoxPro system menu bar.

    Columns are numbered from left to right. The first column is number 0 in the main Microsoft Visual FoxPro window or in a user-defined window. When a control or object is placed in a user-defined window, the row and column coordinates are relative to the user-defined window, not to the main Visual FoxPro window.

    A position in the main Visual FoxPro window or in a user-defined window is determined by the font of the window. Most fonts can be displayed in a wide variety of sizes; some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

    You can position the control or object using decimal fractions for row and column coordinates.

  • CLASS ClassName
    Specifies the class of the control or object. ClassName can be a Visual FoxPro base class or a user-defined class. The following table lists the Visual FoxPro base classes you can specify for ClassName.

Base class names

CheckBox Control Line Control
Column Object ListBox Control
ComboBox Control OLE Container Control
CommandButton Control OLE Bound Control
CommandGroup Control OptionButton Control
Container Object OptionGroup Control
Control Object Page Object
Cursor Object PageFrame Control
Custom Object Relation Object
DataEnvironment Object Separator Object
EditBox Control Shape Control
Grid Control Spinner Control
Header Object TextBox Control
Image Control Timer Control
Label Control  
  • NAME ObjectName
    Specifies the name of the object reference variable to create. The object-oriented properties, events, and methods of the control or object can be manipulated by referencing this variable.

Remarks

@ ... CLASS provides an intermediate step for converting programs and applications created in earlier versions of FoxPro to the preferred object-oriented programming methods of Visual FoxPro. For additional information about backward compatibility with FoxPro 2.x controls, see Controls and Objects.

For information about object-oriented programming in Visual FoxPro, see Object-Oriented Programming.

Example

The following example demonstrates how @ ... CLASS can be used with programming techniques used in earlier FoxPro versions (in this example, use of READ to activate controls). @ ... CLASS is used to create a text box whose properties can be changed with the Visual FoxPro object-oriented programming techniques.

ON KEY LABEL is used to display the Windows Color dialog box when you press CTRL+I. The TextBox is placed on the main Visual FoxPro window using @ ... CLASS, and READ activates the text box.

CLEAR
ON KEY LABEL CTRL+I _SCREEN.PageFrame1.Page1.goFirstName.BackColor;
    = GETCOLOR( )
@ 2,2 SAY 'Press Ctrl+I to change the background color'

@ 4,2 CLASS TextBox NAME goFirstName
READ
CLEAR

See Also

CREATEOBJECT( ) Function | DEFINE CLASS Command | READ Command | _SCREEN System Variable