Objective Grid and Windows XP Visual Styles
 
Grids
 
Database Grids
The record browser window will be drawn with visual styles under Windows XP. In addition, when "Attach Foreign Table" is used, the resultant tabbed combo boxes in the grid cells will have visual styles enabled. Any other controls used, such as the Date/Time Control, Currency control, etc., will also be themed under Windows XP.
Hierarchical Grids
The tree control in the hierarchical grids will be drawn according to the theme enabled. The cell that contains the grid cell will be treated as the tree item and drawn accordingly.
Tabbed Grids
Both the dynamic and static tab classes (CGXTabWnd and CGXDTabWnd) are drawn with header visual styles under Windows XP.
Controls
Objective Grid contains many controls specifically designed to be embedded in grid cells. These controls will have the Windows XP look and feel when they are run under Windows XP. Applications should link to comctrl32.dll using a manifest file.
When Windows XP themes are enabled, the behavior of these controls differs under XP and 2000:
*Separate 2D and 3D versions exist for certain controls (such as CGXCheckBox, CGXRadioButton, etc.) Under Windows XP, the 2D and 3D versions look and behave the same.
*When Windows themes are applied to controls, the control background is governed by the theme and hence can't be modified. For example, in CGXCheckBox there is a facility to replace the bitmaps with custom bitmaps. This will not be possible when the controls are themed. All the drawing for the custom controls is normally done in the Draw() method declared in CGXControl. Therefore, if the visual style for a particular control has to be turned off, use RWSetThemeAppProperties() as follows:
 
void CGridSample8CheckBox::Draw(CDC* pDC, CRect rect, ROWCOL nRow, ROWCOL nCol, const CGXStyle& style, const CGXStyle* pStandardStyle)
{
RWSetThemeAppProperties(0);
CGXCheckBox::Draw(pDC, rect, nRow, nCol, style, pStandardStyle);
RWSetThemeAppProperties(STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT);
}
For detailed procedures on registering a control and overriding a control’s behavior, see Chapter 5, “Using Objective Grid.”
Call RWSetThemeAppProperties() to turn off themes. Remember to reset it at the right place; otherwise themes for the entire window may be turned off.
*The same technique can be used for PrintPreview(). If the controls with visual styles are not needed only for printing, then RWSetThemeAppProperties() can be called in OnBeginPrinting() and reset in OnEndPrinting() of the view class derived from CGXGridView.
 
void CVirtGridView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// TODO: add extra initialization before printing
RWSetThemeAppProperties(0);
CGXGridView::OnBeginPrinting(pDC, pInfo);
}
void CVirtGridView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// TODO: add cleanup after printing
CGXGridView::OnEndPrinting(pDC, pInfo);
RWSetThemeAppProperties (STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT);
}
*All the controls in Objective Grid are derived from CGXControl. Unlike the standard Windows controls, the MouseMove() messages are not forwarded to these controls. Hence by default the controls will not hover when the mouse is moved over. However, some of the custom controls which have a CWnd associated with them, will hover when the mouse is moved over them.
Users can customize this behavior by deriving from these controls and overriding the Draw() Method. Using the standard windows controls through the CGXWndWrapper approach will also work. For detailed information, refer to “Control Architecture.”
CGXCheckBox, CGXCheckBoxEx
The 2D and 3D versions of the CGXCheckBox looks pretty much the same on Windows XP. When drawn with Visual styles, it is not possible to replace the bitmaps with custom ones.
CGXCheckListComboBox
This control is drawn with visual styles for VC++ 7.1 or later. This control uses CCheckListBox from MFC as the base class.
CGXProgressCtrl
The foreground color and the background color of the progress bar can't be changed when visual styles are applied.
CGXRadioButton & CGXRadioButtonEx
The 2D and 3D versions look the same under visual styles in Windows XP.
CGXTabbedComboBoxWnd
The title bar is drawn with a visual styles-like header. In tabbed combo boxes with more than one display column, the active column is marked with the hot style.
Giving Objective Grid an Excel XP Look
 
Headers
When Excel-like headers are used in Windows XP with visual styles enabled, the headers behave like Excel XP. To get the exact look and feel of Excel XP, set solid grid lines by calling:
 
GXSetNewGridLineMode(TRUE, PS_SOLID);
in the InitInstance() of the application.
If the GetParam()->SetExcelLikeHeaders() function is called from OninitialUpdate() with TRUE as the argument, the headers behave like Excel XP headers. If the visual styles are not enabled, then headers will behave like Excel 2000 headers.
Color of Selected Cells
Excel XP uses a different color (i.e. other than black) for filling blocked or selected cells. This can be done programmatically as well by overriding DrawInvertCell() and GetStyleRowCol().
Defining the Color of Cell Headers
You can define a custom color for the headers of selected cells. The coloring of cell headers is OFF by default. When the coloring of cell headers is turned ON, the default highlight color is orange (RGB 255, 180, 95).
Use the following functions to change the cell header to use colors other than the default, which are found in the CGXHeader class of gxctrli.h:
 
BOOL UsesCustomSelectionColor()
void SetUsesCustomSelectionColor(BOOL bEnable)
COLORREF GetCustomSelectionColor()
void SetCustomSelecitonColor(COLORREF clr)