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

13.2 Extending Functionality in Objective Grid

The primary tool to change and/or add functionality to one of Objective Grid's classes is subclassing. In your derived class, you can add new methods to gain functionality, and override existing virtual methods to change existing functionality. One of the hallmarks of Objective Grid is that its classes are rich in virtual functions so you can easily home in on exactly the behavior you want to modify.

Here is an example of how you can change the functionality of an existing class so it can handle things in a different manner. The CGXEditControl class implements a text input control that can be used to display and edit text in cells. Through CGXStyle, you can make this text right-justified, left-justified, or centered within the cell. But suppose you want to make sure there is a 2 pixel margin around the cell so the text will never be displayed within 2 pixels of the border (regardless of the alignment). One way to implement this behavior is to subclass CGXEditControl and override its member method GetCellRect(), which returns the interior rectangle for the cell.

Before you jump in and start subclassing one of Objective Grid's classes, you should always check the class's description, as there may be a property setting that affects the behavior you want. If so, you can avoid the work of subclassing and simply set the property.



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.