class CGXAbstractControlFactory
Abstract base class.
In order to create a Control Factory Class for your application you have to derive a class from CGXAbstractControlFactory and override all the pure virtual methods. The “Control Factory Wizard” fully automates the creation of the Control Factory Class. See the section "Reducing the size of your application" in the Objective Grid User's Guide for more information on how to use the Control Factory Wizard to create a Control Factory Class.
Responsibilities of the Control Factory Class are:
-
Registration of cell types and instantiation of cell type objects on demand.
-
Registration of “concrete implementations” for various Objective Grid features (e.g. Undo/Redo, Serialization, and more).
- Registration of window classes for custom controls in dialog templates.
If you are linking your application statically to Objective Grid and are concerned about the size of your application, a Control Factory lets you specify which cell types should be linked into your application and excludes cell types and features you don’t need. This will shrink the size of your final application.
How do I use the Control Factory Class?
You have two choices:
-
You are not concerned about space considerations – you only want to add new cell types.
- You want to limit the number of cell types or features linked into your application.
If a) is your choice, simply derive a class from CGXControlFactory (the default factory class implementation) and override the following virtual methods:
-
CGXControl* CreateControl(UINT nID, CGXGridCore* pGrid);
-
void RegisterAllControls(CGXStylesMap* pStylesMap);
-
void RegisterAllUserAttributes(CGXStylesMap* pStylesMap);
- ) is your choice, you cannot derive from CGXControlFactory. Instead, you must derive from CGXAbstractControlFactory using the “Control Factory Wizard”. In the “Control Factory Wizard” you can select the cell types and features that should be linked into your application.
In the InitInstance method of your application object, you have to register your control factory by inserting the following line (instead of using the standard GXInit() call):
GXInit(new CMyControlFactory);
In the OnInitialUpdate method of your view class you can specify whether user attributes and cell types should be visible in the CGXStyleSheet by inserting the following lines:
// Register default controls for the CGXStyleSheet-Controls
// page (control objects will be created on demand in
// CGXControlFactory).
stylesmap->RegisterDefaultControls();
// Register user attributes for the CGXStyleSheet-User
// Attributes page (control objects will be created on
// demand in CGXControlFactory).
stylesmap->RegisterDefaultUserAttributes();
If you do not want the attributes and cell types visible in the CGXStyleSheet, then you should skip the previous lines of code. You will still be able to use the cell type objects and user attributes in your grid. They will only be hidden from the user in the CGXStyleSheet.
#include <gxall.h>
See Also
CGXGridCore::GetRegisteredControl GXInit GXTerminate CGXStylesMap::RegisterDefaultControls CGXStylesMap::RegisterDefaultUserAttributes CGXControlFactory