Input Property
Applies To: Grid

Description

This property specifies objects to be associated with cells in a Grid. These objects may be of type Button, ColorButton, Combo, Edit, Label, Spinner or TrackBar. In addition, the Input property may specify instances of OCXClass objects (ActiveX controls) and NetType objects (.NET classes).

The Input property is either a single ref or a simple character scalar or vector, or a vector of character vectors or refs. If it specifies a single object, this will be associated with all of the cells in the Grid. If it specifies a set of objects, these are mapped to individual cells through the CellTypes property.

When a cell becomes the current cell, its value (defined by the appropriate element of the Values property) defines the value of a corresponding property of the associated object The property that corresponds to the value in the cell, depends upon the Type of the associated object as shown in the following table:

 

Associate Object Type Corresponding Property
Label Text
Edit Value
Combo Text
Button (Style  Push) Caption
Button (Style  Radio or Check) State
ColorButton CurrentColor
Spinner Value
TrackBar Thumb
OCXClass Specified by InputProperties
NetType Specified by InputProperties

In effect, the user inputs a new value into the current cell by changing the corresponding property of its associated object. An associated object may be a fixed object that is external to the Grid or a floating object that moves automatically from cell to cell. The latter is achieved by creating the associated object as a child of the Grid.

If the associated object is an Edit or Combo, the user may change the Text property of the object by typing, or, in the case of a Combo, by selecting an item from a list. The new value of the Text property is then used to update the value in the cell (defined by the Values property of the Grid) when the user moves on. If the associated object is a radio button, the value in the cell (0 or 1) is reflected by the State property of the Button. The user may click the Button on and off, changing its State and thereby the corresponding value in the cell.

If the associated object is a ColorButton, the corresponding elements of the Values property contain 3-element integer vectors which specify the RGB colour values.

If the associated object is an instance of an OCXClass object (ActiveX control) or a NetType object (.NET class), the Grid uses the default property of the external object if it has one. Alternatively, the InputProperties property is used to specify which property (or properties) of the external object are to be mapped to elements of Values. If more than one property is specified, elements of Values are vectors.

If there is no object associated with a cell, or if its associated object is a Label or a Button with Style Push, the cell is protected and may not be changed by the user. When the current cell is thus protected, the corresponding row and column titles are not indented as they are when the cell may be edited.

 

If the associated object is a numeric Edit or Label (FieldType Numeric, LongNumeric, Currency, Date, LongDate or Time) the contents of the cell are formatted accordingly, even when it is not the current cell. Thus a cell associated with a Label with FieldType Date, always displays as a date.

If the associated object is a Combo or Button, the appearance of a non-current cell is defined by the corresponding element of the ShowInput property.

The following example illustrates the use of different types of object specified by the Input and ShowInput properties: