The CExtReportGridWnd
class does not support read-only group header area. But it is not very difficult to implement it. First, you should override the CExtReportGridWnd::OnReportGridCreateGroupArea()
virtual method:
CExtReportGridGroupAreaWnd * OnReportGridCreateGroupArea()
{
ASSERT_VALID( this );
CExtReportGridGroupAreaWnd * pGAW = new CYourGroupAreaWnd( *this );
if( ! pGAW->Create(
this,
CRect( 0, 0, 0, 0 ),
7001,
WS_CHILD|WS_CLIPCHILDREN
|WS_CLIPCHILDREN|WS_CLIPSIBLINGS
|WS_TABSTOP
//|WS_VISIBLE
)
)
return NULL;
return pGAW;
}
The
CYourGroupAreaWnd
class implements a non-clickable group area window:
class CYourGroupAreaWnd : public CExtReportGridGroupAreaWnd
{
protected:
virtual LRESULT WindowProc( UINT nMsg, WPARAM wp, LPARAM lp )
{
if( ( WM_MOUSEFIRST <= nMsg && nMsg <= WM_MOUSELAST ) || nMsg == WM_CONTEXTMENU )
return 0L;
else
return CExtReportGridGroupAreaWnd::WindowProc( nMsg, wp, lp );
}
public:
virtual LONG ItemHitTest(
const POINT & ptClient,
RECT * pRectItem = NULL
) const
{
ptClient;
pRectItem;
return -1L;
}
virtual LONG ItemDropHitTest(
const POINT & ptClient
) const
{
ptClient;
return -1L;
}
virtual bool ItemDropMarkerGet(
LONG nHT,
POINT & ptTop,
INT & nHeight
) const
{
nHT;
ptTop;
nHeight;
return -1L;
}
};
The
CYourGroupAreaWnd
class also does not allow you to hit test their items drawn as a stair. As a result, nobody should be able to drop report fields onto it. The next step is to remove all the grouping commands from the context menus. You should override the
CExtReportGridWnd::OnReportGridColumnCtxMenuConstruct()
virtual method and call the parent class method in it and then remove unnecessary menu items from the menu constructed by default.