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

5.1 Cell Value

This section discusses the manipulation of grid values in a regular grid. The Objective Grid class methods presented in this section are the most commonly used subset of available methods. Other sections will discuss relevant methods for manipulating cell values as necessary. For more information about these or other methods, please consult the Objective Grid Class Reference.

5.1.1 Filling the Grid with Values

There are two common methods for putting values into a grid:

  1. CGXGridCore::SetValueRange() — This is a good method to use when only the cell value needs to be changed.

  2. CGXGridCore::SetStyleRange() — This is a good method to use when the cell attributes need to be changed in addition to the value. This usually occurs during (but is not limited to) initialization. The method accepts a style object. You can set the cell value in the style object using CGXStyle::SetValue().

If you are making changes to multiple cells, you should lock the updating mechanism in the grid object using CGXGridCore::LockUpdate(). This will prevent unnecessary redrawing and flickering during multiple updates.

How Objective Grid stores the cell values is very important. There are APIs supplied to set cell values based on numerous data types ranging from double and float to CString and LPCTSTR. Objective Grid always stores those values as strings. When data is passed as anything but a string, Objective Grid converts it using the appropriate precision and then stores it as a string.

5.1.2 Getting Values from the Grid

There are two methods for getting values from the grid:

Both methods return a CString representation of the cell's value. If you need the value as a different data type, you should convert it.

Changes in cell values made by the end user interactively are stored when the cell becomes inactive. This is important to know, because the above two methods return the stored cell value. Calling these methods on an active cell will not reflect a pending value change. With this in mind, there are two ways to get the cell value regardless of the cell's current state.

5.1.3 Clearing Cell Values

To empty a cell or range of cells, call:

Note that the second parameter is FALSE. This indicates that only the cell value should be cleared. Passing TRUE for this parameter will cause all cell style attributes to be cleared.



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.