<< Return to Main Index

< Return to Class Index

CGXGridCore::OnGridInitialUpdate

virtual void OnGridInitialUpdate( );?

Remarks

This overridable method is the core of the initialization process of a grid-view or grid-control. You should override this method if you have any one-time initialization such as registering controls, setting the number of rows and columns, initializing properties or styles.

If you use the grid as a dialog control or embedded window, you are responsible for calling the Initialize-method declared in CGXGridWnd. This can be done after creating the window with two-phase construction or in the CDialog::OnInitDialog method when you embedded the grid as user control in a dialog template. Initialize will call OnGridInitialUpdate.

If you use the grid as a view, OnGridInitialUpdate will be called by the framework after the view is first attached to the document, but before the view is initially displayed. In a workbook this method is called for each worksheet, even if it is not visible.

As mentioned in the class overview, the grid-component distinguishes between shared and unique attributes. Unique attributes are maintained by CGXGridCore. Shared attributes such as row-heights and cell-contents have been moved to an extra class, the CGXGridParam class. Each grid object owns a pointer to a “parameter-object” which is an instance of the CGXGridParam class. The parameter-object maintains several other objects which can be shared by all associated views of one document, such as the properties-object with profile settings, the data-object with the cells-map, the print device-object with the printer settings, the rangelists with selected and covered cells, the undo/redo lists and the column-widths/row-heights-maps. The parameter-object itself can either be maintained by the document or by the grid.

A main task of OnGridInitialUpdate is to attach a parameter-object to the grid. If you do override OnGridInitialUpdate, you can create a parameter-object on your own and attach it to the grid (see the description of SetParam). However, if you do not want to maintain the objects yourself, the base-class version of OnGridInitialUpdate creates all necessary objects, such as the parameter-object, the styles-map-object and the properties-object, on the heap. OnGridInitialUpdate creates only those objects which you did not initialize before.

See SetParam for examples on attaching the parameter-object. See Initialize for examples of two-phase construction of a grid window and usage as custom control in a dialog template.

NoteYou must call the base-class version for this method.

See Also

CGXGridParam CGXGridCore::SetParam CGXGridWnd::Initialize

CGXGridCore

Class Overview | Class Members