CreateGridControl - cCJGrid
Method is called when the grid control is activated
Type: Procedure
Syntax
Procedure CreateGridControl
Call Example
Send CreateGridControl
Description
CreateGridControl is called when the grid COM control is created, which occurs when the object is activated. It contains all of the logic required to initialize the grid, the grid columns and the datasource. It does the following:
- It binds the static COM ReportControl objects to DataFlex objects (e.g., phoReportNavigator and phoReportPaintManager)
- It sets all of the Grid COM properties based on their DataFlex counterparts (e.g., ComFocusSubItems is set based on pbFocusSubItems).
- It sends the event OnCreateGridControl.
- It initializes all columns by sending CreateColumns, which sends the CreateColumn message to each column object. This binds COM ReportColumn objects to the cCJGridColumn class. Each column also is sent OnCreateColumn event.
- It does some additional grid initializations, which must occur after the columns are created.
- It sends LoadEnvironment to possibly restore the prior column layout.
If you wish to set your own custom COM properties, you can do so inside of OnCreateGridControl. Normally this will do what you need and you should not need to augment this method. Note that OnCreateGridControl is called before the columns are initialized.
If you wish to do some final initializations, you could do so by augmenting this message after the forward send. If you need to do some special pre-initializations, you can do so before the forward send.
If you augment this message, you should always forward send this message. If you don't, nothing will work properly.
Upon completion, the grid is initialized and empty. If you need to manually load data you would send the InitializeData message after this message. Often this is done inside of Activating.