Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Grid User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

6.2 The Control Factory Class

Objective Grid provides an abstract base class for Control Factory Classes, the CGXAbstractControlFactory class. This class defines the interface for the Control Factory Class. In order to create a Control Factory Class, derive from CGXAbstractControlFactory and override all pure virtual methods. While the Control Factory dialog of the Build Wizard fully automates the creation of the Control Factory Class, it is helpful to know how the Control Factory Class works:

6.2.1 Registration of Cell Types

In Objective Grid each cell type is implemented through a class derived from CGXControl. CGXControl defines the necessary interface for the grid to be able to interact with cells. CGXControl also implements some default behavior for most functions. Objective Grid has no dependencies on any cell type object. You can derive custom cell type objects from CGXControl or use the default cell types. Only cell types that get registered will be linked into your application or DLL.

Registration of cell types is implemented through the following methods:

virtual CGXControl* 
CreateControl(UINT nID, CGXGridCore* pGrid);
virtual void 
RegisterAllControls(CGXStylesMap* pStylesMap);
virtual void 
RegisterAllUserAttributes(CGXStylesMap* pStylesMap);

6.2.2 Registration of Concrete Implementations for Grid Features

In Objective Grid features that are not essential for every grid application are implemented through abstract base classes. Find and Replace is an example of a feature that only gets linked into your application or DLL if a concrete implementation is registered with the grid. Objective Grid interacts with a concrete FindReplace object through an interface that is defined by an abstract base class. Whenever Objective Grid needs to call a FindReplace-specific method it first checks if a FindReplace object is available.

In the above example m_pFindReplaceImp is a pointer to the abstract base class CGXAbstractGridFindReplaceImp. The FindReplace functionality is implemented in the CGXGridFindReplaceImp class that is derived from CGXAbstractGridFindReplaceImp. A concrete object is instantiated through the ImplementFindReplace method:

Using an abstract base class eliminates any dependencies within Objective Grid to the concrete FindReplace implementation. The abstract base has no implementation and therefore no code for FindReplace needs to be linked into the application or DLL if ImplementFindReplace is not called.

Registration of concrete implementations for grid features (by calling ImplementFindReplace for example) is done with the following methods:

virtual void 
InitializeGridComponents(CGXGridCore* pGrid);
virtual void
InitializeApplicationComponents();


Previous versions of Objective Grid supported the function GXTerminate(), but this function is now obsolete. Please use GXForceTerminate() as stated above.

6.2.3 Registration of Window Classes

Registration of window classes is implemented through the following methods:

virtual void 
RegisterWndClasses(HINSTANCE hInstance);
virtual void 
UnregisterWndClasses(HINSTANCE hInstance);

The following code shows a sample implementation of a Control Factory Class:



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.