Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » Disable Report Grid Group Area Collapse All
Subject Author Date
Paul Cowan Sep 12, 2007 - 10:02 AM

How can I disable the report grid group area so the groupings can not be changed? My app sets the grouping, and I don’t want the user to be able to change it, but I do need the display so the user knows what the grouping is.

I would like to keep the sorting enabled within the group area.

Technical Support Sep 12, 2007 - 12:20 PM

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.