Share via


Display Controls in a Grid

File: ...\Samples\Solution\Controls\Grid\Controls.scx

This sample demonstrates controls displayed in grid columns.

You can add controls to a column in the Form Designer by selecting a column and adding a control, or programmatically with the AddObject method.

There are a few properties that are important for displaying controls in a column.

CurrentControl Property

After you add a control to a grid column, you need to set the column's CurrentControl property to the new control for the new control to be displayed.

Sparse Property

The check boxes on the form make it possible for you to toggle the Sparse property of the grid columns that contain controls. When Sparse is set to .T., the control is only displayed when the focus is on a cell in the column. When Sparse is set to .F., the control is always displayed in each cell in the column.

Controls and Events

Notice that the control in the column processes the events when you set the focus to a cell in the column. For example, if you select a cell in a column with a spinner, when you press the up and down arrows, you increment or decrement the value in the spinner. This is the default behavior for a spinner, not the default behavior for a text box in a grid cell.

See Also

Solutions Samples | Visual FoxPro Foundation Classes A-Z