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

5.4 Columns and Rows

5.4.1 Column and Row Count

The row and column count can be changed at run time using the following APIs:

CGXGridCore::SetColCount()
CGXGridCore::SetRowCount()
CGXGridCore::InsertCols()
CGXGridCore::InsertRows()
CGXGridCore::RemoveCols()
CGXGridCore::RemoveRows()

5.4.2 Column and Row Sizing

5.4.2.1 Using Code to Size

Columns and rows may be sized programmatically using CGXGridCore::SetColWidth() or CGXGridCore::SetRowHeight().

5.4.2.2 End User Resizing

The end user can resize a column or row by dragging the grid line separating two headers. The column to the left or the row above the grid line being dragged is resized. You can change the behavior for end user resizing using:

CGXGridParam::EnableTrackColWidth()
CGXGridParam::EnableTrackRowHeight()

Or turn user resizing off by calling

or

The end user can also size a column or row by double-clicking the adjacent grid line. Again, the column to the left or the row above will be resized. Double-clicking the grid line resets the column or row to the default size. The programmer can specify the default size using:

CGXGridCore::SetDefaultColWidth()
CGXGridCore::SetDefaultRowHeight()

5.4.3 Hidden Columns and Rows

5.4.3.1 Using Code to Hide

Hidden columns have zero width. Hidden rows have zero height. The programmer can hide a column by calling CGXGridCore::HideCols()or hide a row by calling CGXGridCore::HideRows().


Bit visibility flags indicating which columns or rows are hidden are set in the grid object. Visibility flags are stored with a call to StoreHideRow() for each row or StoreHideCol() for each column. The display is updated with UpdateChangedRowHeights() or UpdateChangedColWidths().

CGXGridCore::HideCols()
CGXGridCore::HideRows()

5.4.3.2 End User Hiding and Unhiding

The end user can hide a column or row by resizing the column or row to zero. (User resizing of rows and columns is discussed in Section 5.4.2.2.) Users can unhide hidden columns and rows by double-clicking the grid line where columns or rows are hidden. For example, if column 3 is hidden, the end user could double-click the grid line between the column 2 header and the column 4 header. This will cause column 3 to be resized to the default size. Users can also resize the column or row (using the special cursors shown in Figure 43 and Figure 44) until the column or row is restored.

Figure 43: Resizing a Hidden Column

Figure 44: Resizing a Hidden Row

To prevent users from hiding columns, override CGXGridCore::GetColWidth() as in the following code:

With the same logic, you can use GetRowHeight() to prevent users from hiding rows.

To prevent the user from resizing a hidden row, override OnTrackRowHeight(). Check for IsRowHidden()==TRUE and return FALSE when this is the case.

5.4.4 Frozen Columns and Rows

Frozen columns are columns that will never scroll out of the window; they are always fixed at the left side of the grid. Frozen rows are rows that will never scroll out of the window; they are always fixed at the top of the grid.

CGXGridCore::SetFrozenCols()
CGXGridCore::GetFrozenCols()
CGXGridCore::StoreFrozenCols()
CGXGridCore::UpdateFrozenCols()
CGXGridCore::SetFrozenRows()
CGXGridCore::GetFrozenRows()
CGXGridCore::StoreFrozenRows()
CGXGridCore::UpdateFrozenRows()


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.