Declaring Data Aware Grid Objects
A data aware grid control is created by declaring a grid object based on the cDbCJGrid class.
In the Studio, this would be done by dragging a cDbCJGrid from the Class Palette onto your container object (dbView, etc.) in the Visual Designer.
Object oHiddenColumn is a dbView
Object oCustomer_DD is a Customer_DataDictionary
End_Object
Set Main_DD to oCustomer_DD
Set Server to oCustomer_DD
Set Border_Style to Border_Thick
Set Size to 259 347
Set Location to 2 2
Object oDbCJGrid1 is a cDbCJGrid
Set Size to 249 338
Set Location to 5 5
Set peAnchors to anAll
Set Ordering to 1 // sort data by Customer Index 1
End_Object
End_Object
The grid in the above example does not declare any column objects. It is connected to the customer data dictionary indirectly via the dbView's Server property.
The grid's datasource is created internally when the grid object is created. The datasource is based on the cDbCJGridDataSource class. A handle to this internally created object can be retrieved via the grid's phoDataSource property.
Grid columns are created by declaring column objects based on the cDbCJGridColumn class. Column objects for a grid must be nested inside (child objects of) the grid object. The order that the column objects are declared determines the initial left to right order of the columns in the grid.
In the Studio, you create a column by dragging one or more columns from the Column Selector in the DDO Explorer panel onto your grid object in the Visual Designer. You can change the column ordering by dragging and dropping the column header to the desired position.
Object oCustomer_Name is a cDbCJGridColumn
Entry_Item Customer.Name
Set piWidth to 293
Set psCaption to "Customer Name"
End_Object
Object oCustomer_State is a cDbCJGridColumn
Entry_Item Customer.State
Set piWidth to 72
Set psCaption to "St."
Set pbComboButton to True
End_Object
Object oCustomer_Status is a cDbCJGridColumn
Entry_Item Customer.Status
Set piWidth to 79
Set psCaption to "Status"
Set pbCheckbox to True
End_Object
The above example shows three grid column objects that are bound to the Customer.Name, Customer.State, and Customer.Status table columns respectively.