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

5.8 Deriving a Grid

You should derive from the Objective Grid classes under the following circumstances:

Say that you are using Objective Grid in a dialog. You would use SubclassDlgItem to place a grid window on the dialog. You could then make API calls such as

to initialize the grid object. For this case, there is no need to derive from the grid classes.

On the other hand, say that you want to display a message box when the user clicks on a certain cell. There are no APIs that enable the programmer to do this. In order to display the message box, you have to override a grid virtual function OnLButtonHitRowCol(). This requires that you have a derived CGXGridWnd control.


You cannot use ClassWizard to add these virtual functions. The methods are defined in the Objective Grid library, but ClassWizard will not list them as overridable methods. They are nevertheless available. You can usually copy and paste the declaration for the overrides of your choice from the Objective Grid help files.

Another situation that warrants derivation is when you want to handle standard Windows messages.

Two steps are necessary to derive a class from a CGXGridWnd:

  1. Create a new class with ClassWizard. Use "generic CWnd" as the Class Type.

  2. Next, using a text editor, change the derivation for your window class, in both the .h and .cpp files. All references to CWnd should be replaced by CGXGridWnd.

If you want to derive a class from CGXGridView, use the following steps instead:

  1. Create a new class with ClassWizard. Use "CView" as Class Type.

  2. Next, using a text editor, change the derivation in your window class, in both the .h and .cpp files. All references to CView should be replaced by CGXGridView.

  3. Change the generated OnDraw(), OnBeginPrinting(), and OnEndPrinting() methods to call the base-class CGXGridView version.



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.