<< Return to Main Index

< Return to Class Index

CGXGridCore Class Members

Initialization, Client Area and Parameter Object

Construction

CGXGridCore Constructs a CGXGridCore object. You will only need to call this constructor if you want to attach a CGXGridCore object to a CGXGridHandleView or CGXGridHandleWnd.

Public Interface

SetGridRect Sets the grid rectangle for the window.
GetGridRect Returns the window area for the grid. Unless the grid is in printing-mode or you have explicitly called SetGridRect, the rectangle is determined with GetClientRect.
SetParam Sets a pointer for the parameter-object and defines if the object is lifetime-bound to the grid (if it should be destroyed when the grid is closed).
GetParam Returns a pointer to the parameter-object.
GetPageBreakFirstRows Inline function which returns a reference to the private data member, CGXGridCore::m_awPageFirstRow.
GetPageBreakFirstCols Inline function which returns a reference to the private data member, CGXGridCore::m_awPageFirstCol.
SetPrinting Overridable method that initializes or resets the printing-mode.
IsPrinting Returns TRUE if the grid is in printing-mode.
SetModifiedFlag Overridable method without any functionality that is called when data have been changed. This method is overridden in CGXGridView and calls CDocument::SetModifiedFlag when you call EnableHints(TRUE).
GetViewID Returns a unique identifier for the type of view, useful when you have several different grid-views attached to one document.
GridWnd Returns a pointer to the CWnd that holds the grid and where all drawing happens.
GetGridDoc Returns a pointer to the associated CDocument, if any. Otherwise NULL.
ChangeProperties Call this method if you want to reinitialize the property object, for example after you have displayed the CGXDisplayPropertiesDialog and the user did make changes. The user will be able to undo these changes.
ChangeStylesMap Call this method if you want to reinitialize the styles map, for example after you have displayed the CGXStylesDialog and the user did make changes to the base styles. The user will be able to undo these changes.

Overridables

UpdateAllViews Called to notify all views that the document has been modified (if the grid is bound to a document). The method is overridden in CGXGridView and passes its arguments to CDocument.
OnGridInitialUpdate Initializes the grid-window or grid-view. As mentioned, the parameter-object maintains several other objects. OnGridInitialUpdate checks each object. If an object is not initialized, it will be created and attached to the parameter-object.
CanActivateGrid Called before the grid is deactivated or activated. Checks if the current cell is valid. You may override this method and return FALSE if the grid is in an invalid state and deactivation should be aborted (if this is possible).
OnActivateGrid Called when the grid is being activated or deactivated. If the grid gets deactivated and the current cell is active, the method stores the current cell’s data and deactivates the current cell.
OnGridUpdate Called to notify a view that its document has been modified.
UpdateProperties Called from ChangeProperties to redraw the grid and send a hint to all other views attached to the document.
UpdateStylesMap Called from ChangeStylesMap to redraw the grid and send a hint to all other views attached to the document.

Protected interface

EnableHints You should call this method from OnInitialUpdate when the grid is connected to a document and several views depend on the same data.
OnGridPrepareDC This method initializes the mapping mode to 96 pixels per inch both for printing and display.
SetViewID Specifies a unique identifier for the type of view, useful when you have several different grid-views attached to one document.
SetGridWnd Stores a pointer to the associated CWnd object. This pointer is initialized in the constructor of the derived CGXGridView or CGXGridWnd class and points to the CWnd of the left-hand branch.

Workbook, Record status beam

GetTabWnd Returns a pointer to the CGXTabWnd frame, if any. Otherwise NULL.
GetTabName Returns a string with the sheet name of the grid.
SetTabName Changes the sheet name of the grid.
CanChangeTab Called before the user tries to change the sheet name. You may return FALSE if you want to disable changing the sheet name.
OnTabChanged Called after the user has changed the sheet name.
GetRecordInfoWnd Returns a pointer to the CGXRecordInfoWnd frame, if any. Otherwise NULL.
UpdateRecordInfoWnd Updates the record status beam display with the current cell and row count.
OnInfoWndMoveRecord Called when the user clicked on the navigation buttons in the record status beam.

Cell Formatting

Public Interface (and Overridables)

SetExpressionRowCol Parses the given text and based on the text content assigns a formula, a text label or a number to the specified cell. If you are using the formula engine and you want to force numeric or date values to be stored as string, insert an abostrophe ("'")  at the beginning of the text. Formulas can be stored by inserting an equal sign ('=') at the beginning.
GetExpressionRowCol Returns either the text value or formula for the cell. Numeric values will be converted to a string. If you are using the formula engine text label cells will have a leading abostrophe ("'") to identify them as string.
SetStyleRange Overridable command for applying a given style to the specified range of cells.
SetValueRange Call this method if you want to change the value for a cell or a range of cells.
GetStyleRowCol Overridable method that retrieves the pure style for the specified cell (not inheriting attributes from its base-styles).
GetStyleArray GetStyleArray loops through a give cells of ranges and calls GetStyleRowCol for each cell. The result will be stored in an array that is returned by this method.
GetColStyle Retrieves the base-style for the specified column.
GetRowStyle Retrieves the base-style for the specified row.
GetTableStyle Retrieves the base-style for the table.
ComposeStyleRowCol Overridable method that composes the style for the specified cell by inheriting attributes from its base-styles.
GetValueRowCol Returns the value for the specified cell. The value will be determined by calling ComposeStyleRowCol internally. Please note that the returned reference points to a temporary allocated string.
LookupStyleRowCol Advanced method which retrieves the full style for the specified cell by inheriting all attributes from its base-styles (with ComposeStyleRowCol). The method returns a reference to a temporary style-object being stored in a cache. OnGridDraw empties the cache by calling FreeObjectCache.
SetControlTextRowCol SetControlTextRowCol provides a hook for pasting text into the grid and lets you validate the text. You might add validation into this routine and also adjust the text before you store it in the grid (e.g., remove literals like the ‘$’ or ‘/’ from currency or date values).
ChangeBaseStyle Lets you change the settings of the specifed base-style.
ChangeColHeaderStyle Lets you change the column-header-style settings.
ChangeRowHeaderStyle Lets you change the row-header-style settings.
ChangeStandardStyle Lets you change the standard-style settings.
UpdateBaseStyle This method gets called from ChangeBaseStyle and will update grid internal settings to reflect the new base-style settings. It will also send a hint to all other views attached to the same document.
BaseStyle Returns a reference to a specified base-style.
ColHeaderStyle Returns a reference to the column-header-style.
RowHeaderStyle Returns a reference to the row-header-style.
StandardStyle Returns a reference to the standard-style. Use this method if you want to determine specific settings of the standard-style.

Overridables

StoreStyleRowCol Stores the pure style for the specified cell into the associated data-object.
UpdateStyleRange Updates the window area for the specified range of cells.
CreateStyle Creates a new style object on the heap and returns a pointer to it.
RecycleStyle This is an advanced method which resets a style object and stores it in a buffer. CreateStyle will later reuse this object instead of allocating a new one.

Cell Coordinates

Public Interface

SetRowCount Inserts or removes rows by either calling InsertRows or RemoveRows.
SetColCount Inserts or removes columns by either calling InsertCols or RemoveCols.
GetRowCount Overridable method that returns the number of rows.
GetColCount Overridable method that returns the number of columns.
InsertRows Overridable command for inserting rows.
InsertCols Overridable command for inserting columns
RemoveRows Overridable command for removing rows.
RemoveCols Overridable command for removing columns.
MoveRows Overridable command for moving rows.
MoveCols Overridable command for moving columns.
SetFrozenRows Overridable command for specifying the number of frozen rows that cannot be scrolled out of the window.
SetFrozenCols Overridable command for specifying the number of frozen columns and columns to be used for row headers.
GetFrozenRows Overridable method that returns the number of frozen rows and rows to be used for column headers.
GetFrozenCols Overridable method that returns the number of frozen columns.
GetHeaderRows Overridable method that returns the number of rows to be used for column headers.
GetHeaderCols Overridable method that returns the number of columns to be used for row headers.
SetTopRow Scrolls the view to the specified row.
SetLeftCol Scrolls the view to the specified column.
GetTopRow Returns the topmost non-frozen row of the view.
GetLeftCol Returns the leftmost non-frozen column of the view.
GetClientRow Returns the relative row-index for an absolute row-index.
GetClientCol Returns the relative column-index for an absolute column-index.
GetRow Returns the absolute row-index for a relative row-index.
GetCol Returns the absolute column-index for a relative column-index.
IsDragSelection Returns TRUE when the grid is in row/column dragging-mode.

Menu operations

FreezeCols Freeze selected columns.
FreezeRows Freeze selected rows.
UnfreezeRows Unfreeze frozen rows.
UnfreezeCols Unfreeze frozen columns.
CanFreezeCols Determines if freezing selected columns is possible.
CanFreezeRows Determines if freezing selected rows is possible.
UnfreezeRows Determines if unfreezing frozen rows is possible.
UnfreezeCols Determines if unfreezing frozen columns is possible.

Overridables

OnTestGridDimension OnTestGridDimension is called from the grid whenever it wants to be sure that the grid will not go over the last valid row or column. You should override this method if the row count or column count is not known in advance and therefore needs to be estimated.
StoreInsertRows Inserts rows into the data-structures such as the row-heights-maps, the cells-map, the range lists with selected and covered cells.
StoreInsertCols Inserts columns into the data-structure.
StoreRemoveRows Removes rows from the data-structure.
StoreRemoveCols Removes columns from the data-structure.
StoreMoveRows Moves rows in the data-structure.
StoreMoveCols Moves columns in the data-structure.
StoreFrozenRows Stores the number of frozen rows and rows to be used for column headers to the corresponding attribute of the parameter-object.
StoreFrozenCols Stores the number of frozen columns and columns to be used for row headers to the corresponding attribute of the parameter-object.
UpdateInsertRows Updates the window after inserting rows.
UpdateInsertCols Updates the window after inserting columns.
UpdateRemoveRows Updates the window after removing rows.
UpdateRemoveCols Updates the window after removing columns.
UpdateMoveRows Updates the window after moving rows.
UpdateMoveCols Updates the window after moving columns.
UpdateFrozenRows Updates the window after freezing rows.
UpdateFrozenCols Updates the window after freezing columns.

Dragging Overridables

OnSelDragStart Initializes the row/column dragging-mode. Called when the user has clicked the mouse on a selected row- or column-header.
OnSelDragMove Marks the current destination row or column. Called when the user has moved the mouse to a different row or column.
OnSelDragDrop Resets the dragging-mode and either calls MoveRows or MoveCols to execute the user interaction. Called when the user has released the mouse button.
OnSelDragCancel Called when the grid-window receives a WM_CANCELMODE message and the internal dragging-mode should be canceled.
OnSelDragColsStart Overridable method that is called from OnSelDragDrop when the user has clicked the mouse on a selected column-header.
OnSelDragColsMove Overridable method that is called from OnSelDragMove when the user has moved the mouse to a different column.
OnSelDragColsDrop Overridable method that is called from OnSelDragDrop before columns would be moved and after the user has released the mouse button.
OnSelDragRowsStart Overridable method that is called from OnSelDragDrop when the user has clicked the mouse on a selected row-header.
OnSelDragRowsMove Overridable method that is called from OnSelDragMove when the user has moved the mouse to a different row.
OnSelDragRowsDrop Overridable method that is called from OnSelDragDrop before rows would be moved and after the user has released the mouse button.

Cell Size and Position

Public Interface

SetDefaultRowHeight Overridable command for specifying the default value for the row-height in pixels. Note that row-heights and column-widths are stored internally with logical values. Pixel values depend on the zooming factor and the font size of the standard-style.
SetDefaultColWidth Overridable command for specifying the default value for the column-width in pixels.
SetRowHeight Overridable command for specifying the row-heights for specific rows in pixels.
SetColWidth Overridable command for specifying the column-widths for specific columns in pixels.
HideRows Overridable command for hiding/restoring the specified rows. If you hide rows and restore them later, the rows’ height will be restored to their old values.
HideCols Overridable command for hiding/restoring the specified columns. If you hide columns and restore them later, the columns’ width will be restored to their old values.
ResizeRowHeightsToFit Overridable command that automatically resizes the rows’ height for a specified range of cells. This method calls for each cell the associated control’s CalcSize method to determine the optimal row-height.
ResizeColWidthsToFit Overridable command that automatically resizes the columns’ width for a specified range of cells. This method calls for each cell the associated control’s CalcSize method to determine the optimal column-width.
GetDefaultRowHeight Overridable method that returns the default value for the row-height in pixels. Note that this value is computed from an internally stored logical height which considers the font size of the standard-style and the zooming factor.
GetDefaultColWidth Overridable method that returns the default value for the column-width in pixels.
GetRowHeight Overridable method that returns the row-height for the specified row in pixels.
GetColWidth Overridable method which returns the column-width for the specified column in pixels.
HitTest Determines (Hit-Test) the display context-information for the given point in the window.
Height_DPtoLP Returns the logical height for a pixel-value.
Width_DPtoLP Returns the logical width for a pixel-value.
Height_LPtoDP Returns the pixel-value for a logical height.
Width_LPtoDP Returns the pixel-value for a logical width.
CalcRectFromRowCol Returns the window-area for the given range of cells.
CalcRectFromRowColEx Returns the window-area for the given range of cells considering covered cells. The window area is enlarged. All covered cells in the range will fit into the area.
CalcRectFromRowColExEx Returns the window-area for the given range of cells considering covered, merged and floated cells. The window area is enlarged. All covered, merged and floated cells in the range will fit into the area.
CalcSumOfRowHeights Sums the row-heights for the specified absolute row-Ids.
CalcSumOfColWidths Sums the column-widths for the specified absolute column-Ids.
CalcSumOfClientRowHeights Sums the row-heights for the specified relative row-Ids.
CalcSumOfClientColWidths Sums the column-widths for the specified relative column-Ids.
GetArrayWithRowHeights Fills an array with row-heights. You are responsible for allocating and freeing the array after usage.
GetArrayWithColWidths Fills an array with column-widths. You are responsible for allocating and freeing the array after usage.
CalcClientColFromPt Computes the relative column-index associated with the specified point.
CalcClientRowFromPt Computes the relative row-index associated with the specified point.
CalcRightColFromRect Determines the rightmost column in the given rectangle.
CalcBottomRowFromRect Determines the bottommost row of the given rectangle.
GetFontHeight Returns the height in pixels of the standard-style font. This height is used to convert height values between logical and pixel values.
GetFontWidth Returns the average width in pixels of the standard-style font. This width is used to convert widths values between logical and pixel values.
UpdateFontMetrics Actualizes the average height and width of the standard-style font.
IsTracking Returns TRUE when the grid is in tracking-mode.

Overridables

OnExtHitTest OnExtHitTest will be called from HitTest when no standard hit test area could be determined. Override this method if you want to add custom hit-testing.
StoreDefaultRowHeight Converts the default value for the row-height to a logical value and assigns it to the corresponding attribute of the parameter-object.
StoreDefaultColWidth Converts the default value for the column-width to a logical value and assigns it to the corresponding attribute of the parameter-object.
StoreRowHeight Converts the value of the row-height for the specified row to a logical value and stores it into the row-heights-map of the parameter-object.
StoreColWidth Converts the value of the column-width for the specified column to a logical value and stores it into the column-widths-map of the parameter-object.
StoreHideRow Stores the hidden-flag for the specified row to the hidden rows-map of the parameter-object.
StoreHideCol Stores the hidden-flag for the specified column to the hidden columns-map of the parameter-object.
UpdateChangedRowHeights Updates the window after changing any row-heights.
UpdateChangedColWidths Updates the window after changing any column-widths.
IsRowHidden Overridable method that returns TRUE if the specified row is hidden.
IsColHidden Overridable method that returns TRUE if the specified column is hidden.

Tracking Overridables

OnStartTracking Initializes the tracking-mode. Called when the user has clicked the mouse on a grid-line in the header.
OnMoveTracking Displays the new row-height or column-width. Called when the user has moved the mouse.
OnEndTracking Resets the tracking-mode and executes the user interaction by calling either SetRowHeight, SetColWidth, SetDefaultRowHeight or SetSefaultColWidth. Called when the user has released the mouse.
OnCancelTracking Called when the grid-window receives a WM_CANCELMODE message and the internal tracking-mode should be canceled.
OnTrackColWidth This method is called from ShowContextCursor to determine if it should display a size cursor and from OnStartTracking to determine if the column can be tracked.
OnTrackRowHeight This method is called from ShowContextCursor to determine if it should display a size cursor and from OnStartTracking to determine if the row can be tracked.
OnTrackColWidthStart This method is called when the user has pressed the left mouse button on a grid line. It is called from OnEndTracking to determine if changing the size is possible.
OnTrackColWidthMove The method is called when the user has dragged the mouse. It is called from OnMoveTracking to determine if changing the size to this new value is possible.
OnTrackColWidthEnd The method is called when the user has released the mouse. It is called from OnEndTracking to determine if changing the size is possible.
OnTrackRowHeightStart The method is called when the user has pressed the left mouse button on a grid line. It is called from OnEndTracking to determine if changing the size is possible.
OnTrackRowHeightMove The method is called when the user has dragged the mouse. It is called from OnMoveTracking to determine if changing the size to this new value is possible.
OnTrackRowHeightEnd The method is called when the user has released the mouse. It is called from OnEndTracking to determine if changing the size is possible.

The Current Cell

Public Interface

SetCurrentCell Overridable command that selects a new current cell.
GetCurrentCell Returns TRUE if a current cell exists and retrieves the cell coordinates of the current cell.
IsCurrentCell Returns TRUE if a current cell exists or is the specified cell.
IsActiveCurrentCell Returns TRUE if the current cell is active. If the current cell is active, the CWnd associated with the control is visible and possibly has the focus.
MoveCurrentCell Overridable method that selects a new current cell based on an offset from the existing current cell.
TransferCurrentCell Overridable method that stores and deactivates the current cell or reinitializes the current cell’s contents. Calling this method is very useful if you want to ensure that the current cell’s content is transferred to the grid before performing a specific operation with the grid’s data.
ResetCurrentCell Deactivates the current cell. If you specify TRUE and the content of the control is modified and valid, it will be saved by calling SetStyleRange.

Overridables

ProcessKeys Interprets keyboard strokes sent either from the current cell’s control or the grid-window.
OnGridKeyDown Called from ProcessKeys when the current control did not handle the WM_KEYDOWN message.
OnGridKeyUp Called from ProcessKeys when the current control did not handle the WM_KEYUP message.
OnGridChar Called from ProcessKeys when the current control did not handle the WM_CHAR message.
OnGridDoubleByteChar Called from ProcessKeys for double-byte characters when the current control did not handle the WM_CHAR message.
OnGridDeadChar Called from ProcessKeys when the current control did not handle the WM_DEADCHAR message.
OnGridSysKeyDown Called from ProcessKeys when the current control did not handle the WM_SYSKEYDOWN message.
OnGridSysKeyUp Called from ProcessKeys when the current control did not handle the WM_SYSKEYUP message.
OnGridSysChar Called from ProcessKeys when the current control did not handle the WM_SYSCHAR message.
OnGridSysDeadChar Called from ProcessKeys when the current control did not handle the WM_SYSDEADCHAR message.

Protected interface

StoreCurrentCell Stores the coordinates of the current cell internally in the grid and/or sets a flag specifying if the current cell is positioned.
HideCurrentCell Hides the control’s associated CWnd if any. It will be redrawn with the next call to OnDrawItem.
MoveCurrentCellEx Selects a new current cell based on an offset from the existing current cell by calling MoveCurrentCell but also checks the SHIFT state of the last keystroke to do a selection of cells.
CanSelectCurrentCell Called to determine if the specified cell can be selected or deselected. If the cell gets deselected, CanSelectCurrentCell returns OnValidateCell; otherwise it returns TRUE.

Controls (public interface)

GetCurrentCellControl Returns a pointer to the CGXControl-object associated with the current cell.
GetControl Overridable method that returns a pointer to the CGXControl-object associated with the specified cell. The control-id is determined through the cell’s style-object. The control is determined with GetRegisteredControl.
GetRegisteredControl Returns a pointer to the registered control specified by the control-id. CGXGridCore maintains a map with registered controls.
RegisterControl Registers the CGXControl-object associated with a unique control-id. The control-id should be the ID for a string resource describing the control. The content of the string resource will be used in the control-dialog of the style-sheet.

Notifications

OnCanceledEditing Called from CGXControl::OnCanceledEditing after the current cell’s content is canceled and the control has been reinitialized with the previous cell’s data.
OnCancelEditing Called from CGXControl::OnCancelEditing when the user pressed ESC on the current cell. Return TRUE if the control can be deactivated.
OnClickedButtonRowCol Called when the user has pressed a button (e.g., a pushbutton, hotspot, or radio button). The method is called by CGXControl::OnClickedButton. No return value.
OnDeleteCell Called from CGXControl::OnDeleteCell when the user pressed DELETE on the inactive current cell. Return TRUE if the cell’s data can be deleted.
OnEndEditing Called from CGXControl::OnEndEditing when the user confirmed the contents of the current cell and they are valid. Return TRUE if the data can be accepted.
OnInitCurrentCell Called from CGXControl::Init whenever the control associated with the current cell is initialized. No return value. If the coordinates of the current cell have changed, the method will call OnMovedCurrentCell.
OnModifyCell Called from CGXControl::OnModfiyCell when the user changes text in the current cell.
OnMovedCurrentCell Called when a new current cell has been selected, but the change is not yet visible. The method is called from OnInitCurrentCell when the coordinates of the current cell have changed.
OnLButtonClickedRowCol Called from CGXControl::LButtonUp when the user has clicked and released the left mouse button in a cell.
OnLButtonDblClkRowCol Called from CGXControl::LButtonDblClk when the user has double-clicked the left mouse button in a cell.
OnLButtonHitRowCol Called when the user has clicked the left mouse button in a cell. Subsequent calls occur when the mouse is dragged and when the user releases the mouse button.
OnLeftCell Called from CGXControl::OnLeftCell after the current cell has been deactivated. So, at the time this event is called, there is no current cell in the grid. Override this method if you want to hook into refreshing the current cell after being deactivated.
OnMButtonClickedRowCol Called from CGXControl::MButtonUp when the user has clicked and released the middle mouse button in a cell.
OnMButtonDblClkRowCol Called from CGXControl::MButtonDblClk when the user has double-clicked the middle mouse button in a cell.
OnMButtonHitRowCol Called when the user has clicked the middle mouse button in a cell. Subsequent calls occur when the mouse is dragged and when the user releases the mouse button.
OnMouseMoveOver Called from CGXControl::OnMouseMoveOver when the user moves the mouse over the grid. You may override this method and change the cursor on the fly.
OnRButtonDblClkRowCol Called from CGXControl::RButtonDblClk when the user has double-clicked the right mouse button in a cell.
OnRButtonClickedRowCol Called from CGXControl::RButtonUp when the user has clicked and released the right mouse button in a cell.
OnRButtonHitRowCol Called when the user has clicked the right mouse button in a cell. Subsequent calls occur when the mouse is dragged and when the user releases the mouse button.
OnStartEditing Called from CGXControl::OnStartEditing when the user has pressed a key or the mouse on the current cell. Return TRUE if the control can be activated.
OnValidateCell Called from CGXControl::OnValidate to check if the specified cell’s data is valid. Return TRUE if the cell’s data is valid.

Helpers

SetWarningText Specifies a warning text. If you want to inform the user of an invalid cell with a message box, you should call SetWarningText from your validation method (CGXControl::OnValidate or OnValidateCellRowCol).
DisplayWarningText Overridable method that displays a message box with the warning text specified in SetWarningText.

Drawing

Public Interface

LockUpdate Specifies if subsequent commands should update the display. If you want to improve performance, you should call LockUpdate(FALSE) before you call a number of commands.
Redraw Refreshes the grid-window and scrollbars.
RedrawRowCol Refreshes the specified range of cells.
SubtractBorders Subtracts the area needed for borders from the cell rectangle.
AddBorders Adds the area needed for borders to the cell rectangle.
SetDrawingTechnique Specifies the drawing technique to be used for drawing the grid. You can choose between drawing direct to a device context (which is faster) and drawing through a memory context (less flickering).
LookupOrCreateFont Returns a pointer to a temporary GDI-Font-Object which is internally stored in a cache. This cache will be emptied with the next call to OnGridDraw.
LookupOrCreateBrush Returns a pointer to a temporary GDI-Brush-Object which is internally stored in a cache. This cache will be emptied with the next call to OnGridDraw.
LookupOrCreatePen Returns a pointer to a temporary GDI-Pen-Object which is internally stored in a cache. This cache will be emptied with the next call to OnGridDraw.

Overridables

OnGridDraw Computes the range of cells which need to be drawn and calls OnDrawTopLeftBottomRight.
OnDrawTopLeftBottomRight Draws the specified range of cells.
OnDrawItem Draws an individual cell by calling the associated control’s Draw-method. Cell formattings are determined with LookupStyleRowCol.
MarkEdit Invalidates the headers associated with the current cell.
ShowContextCursor Called in order to display the mouse cursor based on the current mouse position.
SetGridCursor Call this method to explicitly specify the cursor to be displayed in the grid.
LoadFont Called in GridMFC to efficiently load a font into the device context.
FreeObjectCache Called to free all styles and GDI objects in the cache.

Overridables - Printing

OnGridPrint Called by the MFC framework to print or preview a page of the document.
OnGridBeginPrinting Called by the MFC framework at the beginning of a print or print preview job, after CView::OnPreparePrinting has been called.
OnGridEndPrinting Called by the MFC framework at the end of a print or print preview job.
OnPrintHeaderAndFooter Called by OnGridPrint to draw the headers and footers for a page.
OnAdjustPrintRectangle Called by OnGridPrint or OnGridBeginPrinting to determine the drawing rectangle for the grid on the page.

Scrolling

Public Interface

ScrollCellInView Scrolls the cell into the view.
DoScroll Scrolls the view.
SetScrollBarMode Specifies the state of the scrollbars: gxnEnabled for always visible, gxnDisabled for hidden, gxnShared for shared scrollbars. gxnAutomatic is used to enable scrollbars if required.
GetScrollBarMode This function returns the scrollbar-state for the specified scrollbar.
UpdateScrollbars Updates the scrollbars.
LockScrollbars Locks the scrollbars to prevent flickering during longer operations.
SetAutoScroll Specify if grid should enable autoscroll-mode when user is dragging mouse outside the grid.
SetAccelArrowKey Set this TRUE if you want automatic acceleration of the scrolling speed when the user holds down an arrow key.
SetAccelScrollbars Set this TRUE if you want automatic acceleration of the scrolling speed when the user presses a scrollbar button

Protected Interface

AutoScroll Starts the autoscroll-mode. The view will automatically scroll when the user drags the mouse over the window frame.

Overridables

OnAutoScroll Calls DoScroll.
OnLeftColChange Called before the grid scrolls to the left or right.
OnTopRowChange Called before the grid scrolls up or down.
OnLeftColChanged Called when grid has been scrolled to the left or right.
OnTopRowChanged Called when grid has been scrolled up or down.

Zoom, Read-Only

Public Interface

SetZoom Overridable command for specifying the zoom factor.
SetReadOnly Overridable command for setting the read-only state
GetZoom Overridable method that returns the zoom factor of the current view.
IsReadOnly Overridable method that returns the read-only state.

Overridables

StoreZoom Stores the zoom factor of the window-object and sets the last-zoom factor of the property-object. Newly created views will retrieve their initial zoom factor from the property-object.
StoreReadOnly Sets the read-only attribute of the parameter-object.
UpdateZoom Redraws the view after changing the zoom factor.
UpdateReadOnly Resets the edit control.

Selections, Spanned Cells

Public Interface

SelectRange This method allows you to turn on/off the selection for a specific range of cells.
SetSelection Selects a range of cells, rows or columns and inverts the cells (this is a more advanced method used internally in the grid).
CopyRangeList Copies the range list and adds the current cell as range to the destination list on demand.
GetSelectedCols Returns an array of selected columns.
GetSelectedRows Returns an array of selected rows.
SetCoveredCellsRowCol Overridable command for setting the covered cells-range for a cell. Covered cells span several cells.
GetCoveredCellsRowCol Overridable method that returns the corresponding covered cells-range of the specified cell. You should override this method when you want to specify covered cells virtually at run time.
IsSelectingCells Returns TRUE if the user has clicked into the grid and is selecting cells.
GetHitState This method returns some interaction-state if the user is doing some mouse interactions (e.g., selecting cells).
CanFloatCell Objective Grid calls this method to check if it is possible to float a cell or hide a cell by another floating cell.
CanMergeCell Objective Grid calls this method to check if it is possible to merge a cell in the specified direction (vertical or horizontal).
CanMergeCells This virtual method is called to determine if two neighboring cells can be merged.
DelayFloatCells Call DelayFloatCells when you want to recalculate floating cells.
DelayMergeCells Call DelayMergeCells when you want to recalculate merge cells.
EvalFloatCells EvalFloatCells is called in Objective Grid when the user scrolls through the grid. EvalFloatCells checks if there are any pending cells that are marked to be recalculated. Each of the marked cells will be checked if its contents fit into the cell or if the cell can float over other cells.
EvalMergeCells EvalMergeCells is called in Objective Grid when the user scrolls through the grid. EvalMergeCells checks if there are any pending cells that are marked to be recalculated. Each of the marked cells will be checked to see if its contents fit into the cell or if the cell can float over other cells.
EvalVisibleFloatMergeCells Evaluates both floating and merge cells for the currently visible range of cells in the grid.
GetCellRangeRowCol This method checks whether the cell is a spanned cell or if it is hidden by a spanned cell and returns the range of the spanned cell.
GetFloatCellsMode Returns the setting that specifies if floating cells is enabled.
GetFloatedCellsRowCol Call this method if you want to check if a cell is a floated cell or hidden by another floated cell.
GetMergeCellsMode Returns the setting that specifies if merging cells is enabled.
GetMergedCellsRowCol Call this method if you want to check if a cell is a merged cell.
SetFloatCellsMode With SetFloatCellsMode you can turn on and off the calculation of floating cells in the grid.
SetMergeCellsMode With SetMergeCellsMode you can turn on and off the calculation of merge cells in the grid.

Overridables

StoreSelectRange This method is called when the selection for a specific range of cells shall be turned on/off.
UpdateSelectRange This method is called after the selection for a specific range of cells has been turned on/off and the change shall be made visible.
PrepareChangeSelection Inverts the cells before the rangelist is updated.
PrepareClearSelection Resets all inversions before the rangelist is emptied.
GetInvertStateRowCol This is an advanced method which is called in the grid when drawing cells to determine if they should be inverted. Returns TRUE if the specified cell shall be drawn inverted; FALSE if not.
StoreCoveredCellsRowCol Stores the covered cells-range into the covered cells-list maintained by the parameter-object.
UpdateCoveredCellsRowCol Redraws the area covered by the range.
MergeCoveredCells Advanced overridable which loops through all possible covered cells-ranges and expands a given area. You should override this method when you want to specify covered cells virtually at run time.

Notifications

OnStartSelection This method is called to determine if the user can start selecting cells at a given cell. You can override this method if you want to restrict the area where the user can select cells.
CanChangeSelection This method is called before a range of cells, rows or columns will be selected or if the range shall be modified. You can override this method if you want to restrict the area where the user can select cells.
OnChangedSelection This method is called when a range of cells, rows or columns has been selected or if the range has been modified.

Undo/Redo

Public Interface

Undo Undo the previous command.
Redo Redo the previous undone command.
BeginTrans Marks the beginning of a transaction-like block of commands. All subsequent commands will be undone, redone and rolled back in one step.
CommitTrans Marks the end of a transaction.
Rollback Undo all commands since the start of the transaction without generating redo information.
CanUndo Checks if there are command objects in the undo list and fills the CCmdUI object with a description of the next undo operation.
CanRedo Checks if there are command objects in the redo list and fills the CCmdUI object with a description of the next redo operation.

Overridables

AddCommand Adds a command-object either to the undo- or redo-list depending whether the command is executed the first time, undone or redone.
OnCellUndone Scrolls the cell into the view after successfully undoing a command. If the user has undone a transaction, the command only stores the coordinates.

Find and Replace

Public Interface

FindText Searches for a string within the column of the current cell.

Overridables

OnFindNext Finds next occurrence of a text string in the column of the current cell.
OnReplaceAll Replaces all occurrences of a given string with a new string in the column of the current cell.
OnReplaceSel Replaces the text currently selected in the current cell.
OnTextNotFound Called when a find operation fails to match any further text.
OnShowFindReplaceDialog Displays the standard Find or Replace dialog box.

Clipboard / Clearing Cells

Public Interface (Overridable methods)

CanClear Determines if clearing cells is possible.
CanCopy Determines if copying data to clipboard is possible.
CanCut Determines if cutting data to clipboard is possible.
CanPaste Determines if pasting data from clipboard is possible.
Clear Clears the contents of the selected cells.
Copy Copies selected data (by the user) or current cell to the clipboard.
CopyRange Copies the specified range of cells to the clipboard.
Cut Copies selected cells to the clipboard and clears all style information for the cells.
CutRange Copies the specified range of cells to the clipboard and clears all style information for the cells.
Paste Paste data from clipboard.

Direct Copy and Paste

CopyCells Command for copying cells from source to dest. Cell references in formula expressions (unless marked as absolute range) will be adjusted.
MoveCells Command for moving cells from source to dest. Cell references in formula expressions that depend on cells in the moved range will be adjusted.
OnPasteDirect CGXGridCore::Paste will call OnPasteDirect when direct copy/paste is enabled and the user has marked cells in the grid to be copied. OnPasteDirect will call MoveCells or CopyCells to copy/move the cells. When using the formula engine direct copy/paste will also update all cells with formulas that have references to the moved cells.
StoreCopyCells Called from the CopyCells command to copy cells from source to dest. Cell references in formula expressions (unless marked as absolute range) will be adjusted.
StoreMoveCells Called from the MoveCells command to move cells from source to dest. Cell references in formula expressions that depend on cells in the moved range will be adjusted.

Reading and writing text files

CalcBufferDimension Determines the number of rows and columns in the specified buffer. The text values must be available in tab-delimited form in the buffer. Newline characters indicate that a new row should be started.
CopyTextToFile Writes the text values of the specified range of cells in tab-delimited format to a CFile.
PasteTextFromBuffer Pastes the text values from the specified buffer to the grid. The text values must be available in tab-delimited form in the buffer. Newline characters indicate that a new row should be started.
GetCopyTextRowCol This virtual method is called from CopyTextToFile to get the text for a given cell. You might override this method if you want to copy formula expressions instead of the cell value.
PasteTextRowCol This virtual method is called from PasteTextFromBuffer to store the text in a specific cell. By default PasteTextFromBuffer will store the text by simply calling SetControlTextRowCol. If the text starts with an equal sign ('=') it will be treated as formula.

Reading and writing CArchive

CopyCellsToArchive Serializes the cell (style) objects of the specified range of cells to a CArchive.
PasteCellsFromArchive Pastes the cell contents from the CArchive to the grid. If the specified range differs from the dimension stored in the CArchive object, OnPasteDiffRange will be fired to determine if the operation shall be canceled.
GetClipboardStyleRowCol This virtual method is called from CopyCellsToArchive to get the style information for a specific cell.

Supported clipboard formats

OnPasteFromClipboard Pastes cells from the clipboard. CGXGridCore::Paste will call this method after it has opened the clipboard.
OnCheckClipboardFormat Determines if cells can be pasted from the clipboard. The base-class version supports both CF_TEXT and internal format. Override this method if you want to support additional clipboard formats.

Excel-like auto fill

ImplementExcelLikeFill Provides a concrete implementation for excel like auto fill feature.
OnStartAutoFillSelection Called when the user begins an auto fill selection by clicking on the auto fill handle of a selected range of cells.
CanChangeAutoFillSelection Called for each new selection as long as the user presses the mouse.
DoAutoFill Performs a simple fill.
OnAutoFillDone Called after the user has finished drag selecting a new range for auto fill and the new range is filled with data from the beginning range.

Other helpers and overridables

ClearCells Clears the contents of each cell in the specified range.
OnPasteDiffRange Called from PasteCellsFromArchive when the range differs from the selected range of cells in the grid. You should return FALSE if the paste operation should be canceled.

Sorting

Public Interface

MoveDataCols MoveDataCols is called from SortCols to rearrange the columns in the grid. MoveDataCols will call the virtual method StoreMoveDataCols for changing the data structure and UpdateMoveDataCols for updating the display.
MoveDataRows MoveDataRows is called from SortRows to rearrange the rows in the grid. MoveDataRows will call the virtual method StoreMoveDataRows for changing the data structure and UpdateMoveDataRows for updating the display.
SortCols Call this method to sort the columns in a grid.
SortRows Call this method to sort the rows in a grid.

Overridables

GetSortKey This method is called to return the sort key for a given cell. By default, GetSortKey calls CGXControl::GetSortKey which will return the value of the cell.
OnGetSortColsKey This method is called from SortCols to get the sort keys for the column. OnGetSortColsKey loops through all rows specified for the sort order and calls CGXGridCore::GetSortKey to get the sort key for each specified row in the column.
OnGetSortRowsKey This method is called from SortRows to get the sort keys for the row. OnGetSortRowsKey loops through all columns specified for the sort order and calls CGXGridCore::GetSortKey to get the sort key for each specified column in the row.

Protected Interface

StoreMoveDataCols This virtual method is called to rearrange the columns in the grid.
StoreMoveDataRows This virtual method is called to rearrange the rows in the grid.
UpdateMoveDataCols Updates the window after sorting columns in the grid. The method calls Redraw and sends a hint to other views attached to the same document.
UpdateMoveDataRows Updates the window after sorting rows in the grid. The method calls Redraw and sends a hint to other views attached to the same document.

OLE Drag and Drop

Public Interface - Data Source

EnableOleDataSource Call this method to enable OLE Drag&Drop functionality in the grid for dragging cells to other OLE Drag&Drop-enabled applications.
DndStartDragDrop Starts the Drag&Drop operation.

Overridables - Data Source

OnDndCacheGlobalData This overridable is called from DndStartDragDrop to supply the clipboard data for the Drag&Drop operation. You might override this method if you want to add clipboard formats other than CF_TEXT and the internal style clipboard format.

Public Interface - Drop Target

EnableOleDropTarget Call this method to make the grid an OLE Drop Target.

Overridables - Drop Target

OnDndCalculateFocusRect This overridable is called to determine the boundaries for the focus rectangle based on the data in the OLE data object when the user moves the mouse into the grid window.
OnDndQueryAcceptData This overridable is called to determine whether the grid can handle the clipboard formats available in the OLE data object.
OnDndDropData This overridable is called to paste the data from the OLE data object into the grid.

Tooltips

EnableGridToolTips Call this function to enable support for tooltips on cells.

Cell Tips

EnableCellTips Call this function to enable support for cell tips.

Plug-Ins, Intelli-Mouse

AddPlugin Call this method to register a plug-in component object with the grid. The grid loops through all registered plug-in component object in its WindowProc. All registered objects will be deleted when the grid is destroyed.
EnableMouseWheel Adds support for Intelli-Mouse mouse-wheel scrolling and zooming to the grid. Call this method at initialization time of your grid, e.g. before calling OnGridInitialUpdate or Initialize.
EnableIntelliMouse Adds support for Intelli-Mouse mouse-wheel panning, scrolling and zooming to the grid. Call this method at initialization time of your grid, e.g. before calling OnGridInitialUpdate or Initialize.
EnableScrollTips Adds support for scroll-tips to the grid. Call this method at initialization time of your grid, e.g. before calling OnGridInitialUpdate or Initialize.

Formula Engine Specific Methods

Initialization

EnableFormulaEngine Enables the formula engine for the grid. Call this function before you call OnGridInitialUpdate or Initialize.
GetSheetContext Returns a pointer to the CGXFormulaSheet.

Range Names

SetRangeName Adds a named range or replaces an existing named range with the new range settings.
GetRangeName Returns the associated range for a given range name.
DeleteRangeName Deletes a named range from the range name list.

Drawing

GetUpdateFlag Checks if the given cell needs to be redrawn (e.g. if formula result has been changed). CGXGridCore::RefreshViews checks GetUpdateFlag for all visible and refreshes them if GetUpdateFlag returns TRUE.
SetUpdateFlag Forces the given cell to be redrawn with the next RefreshViews() call.
RefreshViews RefreshViews invalidates the whole grid display area and then loops through all visible cells and checks GetUpdateFlag. Only cells that are marked via GetUpdateFlag will be painted. Typically RefreshViews will be called after the user has changed a cell. RefreshViews will then refresh all cells that have dependencies on the changed cell.

Recalculating Formulas

AddRecalcRange Marks a give range of cells so that formula cells that depend on the marked cells will later be reevaluated. The formula engine maintains a recalc range list where all these ranges are added.
Recalc Recalculates all cells in the worksheet that depend on cells in the recalc range list.
ResetError Resets the error state of the formula engine.
GetError Returns the error state of the formula engine. Objective Grid will call this method and if necessary display a message box with error information based on the return value of this GetError method.

Control Factory

ImplementAutoScroll Provides implementation for Autoscrolling that will scroll the grid when the user presses a mouse button and drags the mouse out of the grid window.
ImplementCalcSize Provides implememtation of CalcSize method for static cells. (Used by ResizeRowHeightsToFit).
ImplementClearCells Clear out cells when user pressed DELETE key. This component provides a concrete implementation for the ClearCells method.
ImplementCoveredCells Allow usage of covered cells in the grid.
ImplementCutPaste Implements support for clipboard operations: Cut, Copy and Paste.
ImplementDirectCopyMoveCells Implements support for direct copying, moving of cells within one grid (MoveCells and CopyCells API).
ImplementDrawSpannedCells Provides support for drawing spanned cells (used by covered, floating and merge cells).
ImplementExcelLikeFrame Provides implementation for Excel-like Selection Frame.
ImplementFindReplace Provides implementation for Find and Replace.
ImplementFloatCells Implementation for Floating Cells. You can enable and customize floating cells behavior with the SetFloatCellsMode method in your grid.
ImplementFreezeMenuHelper Provides implementation for FreezeRows, UnfreezeRows, FreezeCols and UnfreezeCols menu handlers.
ImplementGridSort Provides implementation for sorting rows or columns.
ImplementHideCells Provides implementation for hiding rows and columns.
ImplementMarkEditHeader Outline row and column header of current cell.
ImplementMergeCells Implementation for Merge Cells. You can enable and customize merge cells behavior with the SetMergeCellsMode method in your grid.
ImplementMoveRowsCols Check this if you have disabled "UserDragSelectRange" and you want to move columns and rows programmatically by calling MoveRows() or MoveCols().
ImplementOldDrawing Old Drawing, backward compatible with version 1.2.
ImplementOptimizedUpdate Provides implementation for optimized updating of grid when inserting, moving, removing or resizing rows or columns.
ImplementPrinting Grid Printing: Provides implementation of printing routines that allow you to print and print preview grid.
ImplementRangeName Provides support for setting and deleting range names when formula engine is attached to the grid.
ImplementResizeToFit ResizeToFit: Provides implementations for the ResizeRowHeightsToFit and ResizeColWidthsToFit methods.
ImplementStyleDataExchange Implements support for reading and writing cells in internal format. Clipboard and OLE Drag and Drop operations use StyleDataExchange when you specify the GX_DNDSTYLES flag.
ImplementTextDataExchange Implements support for reading and writing cells with text (CSV) format. Clipboard and OLE Drag and Drop operations use TextDataExchange when you specify the GX_DNDTEXT flag.
ImplementToolTips Support for Tooltips in cells. You can turn on and off tooltips for each grid individually with EnableGridToolTips.
ImplementUndoRedo Implements undo and redo support for undoing and redoing operations.
ImplementUpdateHint Provides implementation of the update hint mechanism that synchronizes changes between several views of one document.
ImplementUserDragSelectRange Provides implementation for dragging selected rows or columns with mouse.
ImplementUserResizeCells Provides implementation for resizing rows or columns with the mouse.
ImplementUserSelectRange Provides implementation for selecting cell ranges with mouse or keyboard or SelectRange API.

Attributes

m_nClipboardFlags Holds options for copying/pasting cells.
m_bDisableMouseMoveOver Set this attribute FALSE if you want the grid to call CGXControl::MouseMoveOver when the user moves the current cell over the grid. The default setting is TRUE. This means the grid will not call CGXControl::MouseMoveOver.
m_bHitTestSelEdge TRUE if HitTest shall generate a GX_HITSELEDGE value when the cursor is over the edge of a selected range of cells (OLE Drag and Drop will check for this new value). FALSE if HitTest shall return no special value.
m_bRefreshOnSetCurrentCell Specifies whether cells need to be redrawn when they become the current cell in the grid. If you set this attribute to be TRUE, some grid internal optimization that outline the current without redrawing the cell are turned off.
m_nHitTestFrame Specifies the size of the hit-test area around grid lines. Default is 8 pixels.
m_nPrintHandleRecordCount Specifies printing behavior of Objective Grid when used in browser grids or any other grids where the row count is not known in advance.
m_awPageFirstRow Stores a list of vertical page breaks by row in a CRowColArray
m_awPageFirstCol Stores a list of horizontal page breaks by column in a CRowColArray

CGXGridCore

Class Overview