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

5.15 Miscellaneous

5.15.1 Using CGXDrawingAndFormatting

CGXDrawingAndFormatting encapsulates some general methods used for drawing and formatting text in Objective Grid. In earlier versions, these methods were global methods. The disadvantage was that there was no possibility for you to customize these methods without modifying the source code.

The CGXDrawingAndFormatting class gives you the ability to override the default behavior of these methods.

If you have derived a class from CGXDrawingAndFormatting you can force Objective Grid to use your customized methods by calling SetDaFTools().

where CMyDrawingTools must be derived from CGXDrawingAndFormatting.

See "Macros And Globals" in the Objective Grid Class Reference for a description of these methods.

5.15.2 IntelliMouse Support

To enable IntelliMouse Support for Objective Grid, you should add a call to EnableIntelliMouse() before calling OnGridInitialUpdate() or Initialize().

The IntelliMouse support in Objective Grid is very similar to the IntelliMouse support in Microsoft Excel and Microsoft Internet Explorer. Objective Grid supports the following features:

5.15.3 Rotated Text in Cells

To display rotated text in a cell, use CGXFont::SetOrientation() and specify the angle.

Please note that only single lines are support for rotated text. Objective Grid does not support word-break with rotated text.


It is possible to add support for rotated text in the font page by adding a combo box with style set to "Simple" to the IDD_DIALOG_FONTPAGE template. When you specify IDC_GXCBORIENTATION as the resource ID for this combo box, the font page will allow the user to specify the font orientation via the combo box.

5.15.4 Character Sets

Objective Grid has support for different character sets. You can assign a specific character set to a cell via SetFaceName().

You can also specify if the character set should be displayed in the font page of the stylesheet by setting

The default is FALSE (character sets will not be displayed in the font page).

Enabling Japanese in ANSI-DBCS Grid build types using the Japanese locale may require following workaround:

5.15.5 Direct Copying and Moving of Cells

The CGXGridCore::CopyCells() and CGXGridCore::MoveCells() APIs lets you easily copy or move a given range of cells to a new destination.

You can also force CGXGridCore to use these new commands for doing Copy/Paste and OLE drag & drop commands within a worksheet by setting the m_bDirectCopyPaste and m_bDirectCutPaste attributes in the CGXGridParam object.

When using direct cut and paste, cell values will not be cleared until you paste data into the same worksheet. When you select cells and then select the menu item Edit|Cut, the selected cells will be marked with a gray background. This indicates that the cells will be cleared once the paste operation is completed.

5.15.6 AutoScrolling

When you click on a scrollbar or if you press an arrow key, scrolling will accelerate incrementally. Also, when dragging the mouse out of the grid, autoscrolling will accelerate incrementally. The user can slow down the scrolling speed by moving the mouse nearer to the grid or speed up the scrolling by moving the mouse farther away from the grid.

5.15.7 OLE Drag and Drop Integration

To add OLE Drag and Drop support to your grid, simply:

  1. Add a call to EnableOleDropTarget() and a call to EnableOleDataSource() during initialization for your grid object (usually in your override of CDialog::OnInitDialog() or CView::OnInitialUpdate()).

  2. If you want to customize the OLE Drag and Drop behavior, you can pass a combination of flags as the parameter.

  3. Add a call to AfxOleInit() in your project's override of CWinApp::InitInstance().


    You can still continue to use the traditional MFC approach by embedding a CGXGridDropTarget as member variable into your grid or parent dialog. The MFC approach is still supported (for the time being), but we recommend that you use the newer approach when you write new grids.

5.15.7.1 Enabling "Drag and Copy"

A popular Excel feature allows users to copy (but not move) values by dragging with the mouse while holding down the Ctrl key. To enable this functionality in your grid:

  1. Enable OLE Drag and Drop.

  2. Add the OnGridDragOver() override shown below.

    This technique is shown in the sample located at <stingray-installdir>\Samples\Grid\Tutorial\1stGrid\Step3.


    For more information on the DROPEFFECT type, see the Visual C++ online help.

5.15.8 Scroll Tip Support

Before Objective Grid 6.1, the programmer had to override the WM_VSCROLL and WM_HSCROLL messages. With Objective Grid 6.1 and later, you only need to call:

during the initialization for your grid object. This will enable the display of the row and column number when the user is dragging the scrollbar thumb.

However, if you want to customize the text displayed in the scroll tips, you need to use the old approach instead. Embed a CGXScrollTip object into your derived class and forward WM_VSCROLL and WM_HSCROLL messages to the CGXScrollTip object.

5.15.9 CellTip Support

You can enable cell tips by calling EnableCellTips()during initialization for the grid object. Cell tips are implemented using Objective Grid's plug-in classes. They are essentially fly-by windows that appear when the following conditions are met:

A similar feature can be seen in Visual Studio Solution Explorer window or in the Windows Explorer tree view.



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.