|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
David Skok
|
Nov 9, 2006 - 6:20 AM
|
in a in CExtGridWnd.
I use the following style settings in a CExtReportGridWnd:
SiwModifyStyle( __EGBS_GRIDLINES |__EGBS_SFM_CELLS_V |__EGBS_LBEXT_SELECTION |__EGBS_MULTI_AREA_SELECTION |__EGBS_NO_HIDE_SELECTION , __EGBS_SFB_MASK );
BseModifyStyle( __EGWS_BSE_EDIT_RETURN_CLICK |__EGWS_BSE_EDIT_SINGLE_FOCUSED_ONLY |__EGWS_BSE_EDIT_DOUBLE_LCLICK |__EGWS_BSE_EDIT_CELLS_INNER |__EGWS_BSE_EDIT_AUTO |__EGWS_BSE_BUTTONS_IN_FOCUSED_ROW , __EGWS_BSE_BUTTONS_PERSISTENT );
NOTE: BseModifyStyle included just in case, shouldn’t affect the problem
I like the style because it allows multiple full row selection but the focused cell is not highlighted but rather stands out like it is in edit mode. Left and right arrow keys change the selection rather than scroll the display. What style settings produce the same feature in CExtGridWnd?
The following comes close to getting what I want but no cell is focused and as a result left and right arrows scroll the entire grid.
SiwModifyStyle( __ESIS_STH_PIXEL |__ESIS_STV_PIXEL |__EGBS_GRIDLINES // |__EGBS_SFM_CELLS_V |__EGBS_LBEXT_SELECTION |__EGBS_SFM_FULL_ROWS |__EGBS_MULTI_AREA_SELECTION |__EGBS_NO_HIDE_SELECTION , __EGBS_SFB_MASK );
BseModifyStyle( __EGWS_BSE_EDIT_RETURN_CLICK |__EGWS_BSE_EDIT_SINGLE_FOCUSED_ONLY |__EGWS_BSE_EDIT_DOUBLE_LCLICK |__EGWS_BSE_EDIT_CELLS_INNER |__EGWS_BSE_EDIT_AUTO |__EGWS_BSE_BUTTONS_IN_FOCUSED_ROW , __EGWS_BSE_BUTTONS_PERSISTENT );
One last comment. It seems like while the style settings I’m using in the CExtReportGridWnd produce the effect I want, there is some bug that makes it work the way it does because I have full row highlighting but the __EGBS_SFM_FULL_ROWS style is not set. I tested both styles in ReportGrid and SimpleGrids samples and they work the same as in my app.
Thanks for any help
|
|
Technical Support
|
Nov 9, 2006 - 12:46 PM
|
You can achieve this by using a class derived from CExtGridWnd in which the following two methods are overridden in a way like this: virtual CRect & _SelectionAreaConvert( CRect & rcArea ) const
{
ASSERT_VALID( this );
rcArea.left = 0;
rcArea.right = ColumnCountGet();
if( rcArea.right > 0 )
rcArea.right --;
return rcArea;
}
virtual bool SelectionGetForCellPainting(
LONG nColNo,
LONG nRowNo
) const
{
ASSERT_VALID( this );
CPoint ptFocus = FocusGet();
if( nColNo == ptFocus.x
&& nRowNo == ptFocus.y
)
return false;
return true;
} The last thing is to use these two styles in your grid: __EGBS_SFM_CELLS_H | __EGBS_SFM_CELLS_V
|
|
David Skok
|
Nov 9, 2006 - 2:39 PM
|
This is closer to what I’m looking for. All the grid items are highlighted, I want only the selected ones to be highlighted. I tested your suggestion in my app as well as in SimpleGrids and it does the same in both. I’m now using the following style as well as the suggested overrides.
SiwModifyStyle( __ESIS_STH_PIXEL |__ESIS_STV_PIXEL |__EGBS_GRIDLINES
|__EGBS_SFM_CELLS_H |__EGBS_SFM_CELLS_V
|__EGBS_LBEXT_SELECTION // |__EGBS_SFM_FULL_ROWS |__EGBS_MULTI_AREA_SELECTION |__EGBS_NO_HIDE_SELECTION , __EGBS_SFB_MASK );
|
|