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 » CExtReportGridWnd Collapse All
Subject Author Date
Sebastian Leopold May 6, 2008 - 3:14 PM

Hello,
how can I prevent all columns from deletion ? I don’t want that the user can remove a column from the grid.

I mean you can remove a column by dragging it out of ReportgGrid Area. I dont want that.

regards
Sebastian Leopold

Sebastian Leopold May 8, 2008 - 1:38 PM

You dont understand me,
No column should be removeable !!!

regards
Sebastian Leoplld

Technical Support May 10, 2008 - 12:14 PM

Please remove the __EGBS_BSE_EX_DRAG_REMOVE_COLUMNS style from your report grid. You can do this using its BseModifyStyleEx() method.

Technical Support May 7, 2008 - 2:50 PM

Please add the following line to the ../Prof-UIS/Include/ExtReportGridWnd.h:

#define __ERGS_ENABLE_DEACTIVATION_OF_LAST_COLUMN                 0x00000080
Then update the source code for the following two methods in the ../Prof-UIS/Src/ExtReportGridWnd.cpp:
void CExtReportGridWnd::OnGridOuterDragOut(
      const CExtGridHitTestInfo & htInfo
      )
{
      ASSERT_VALID( this );
      ASSERT( ! htInfo.IsHoverEmpty() );
      ASSERT( htInfo.GetInnerOuterTypeOfColumn() == 0 );
      ASSERT( htInfo.GetInnerOuterTypeOfRow() == (-1) );
CExtGridCell * pCellTmp =
            GridCellGet( htInfo );
      ASSERT_VALID( pCellTmp );
CExtReportGridColumn * pRGC =
            STATIC_DOWNCAST( CExtReportGridColumn, pCellTmp );
bool bDeactivate = true;
DWORD dwReportGridStyle = ReportGridGetStyle();
      if( ( dwReportGridStyle & __ERGS_ENABLE_DEACTIVATION_OF_LAST_COLUMN ) == 0 )
      {
            LONG nActiveColCount = ReportColumnGetCount( true, false );
            if( nActiveColCount == 1 )
                  bDeactivate = false;
      }
      if( bDeactivate )
      {
            VERIFY( ReportColumnActivate( pRGC, false ) );
      }
}

bool CExtReportGridWnd::OnReportGridQueryColumnKeepActiveOnGroupingBehavior(
      __EXT_MFC_SAFE_LPCTSTR strColumnName,
      __EXT_MFC_SAFE_LPCTSTR strCategoryName
      ) const
{
      ASSERT_VALID( this );
DWORD dwReportGridStyle = ReportGridGetStyle();
      if( ( dwReportGridStyle & __ERGS_KEEP_COLUMNS_ACTIVE_ON_GROUPING ) != 0 )
            return true;
const CExtReportGridColumn * pRGC =
            ReportColumnGet( strColumnName, strCategoryName );
      if( pRGC == NULL )
            return false;
      if( ( pRGC->GetStyleEx() & __EGCS_EX_KEEP_ACTIVE_ON_GROUPING ) != 0 )
            return true;
      if( ( dwReportGridStyle & __ERGS_ENABLE_DEACTIVATION_OF_LAST_COLUMN ) == 0 )
      {
            LONG nActiveColCount = ReportColumnGetCount( true, false );
            if( nActiveColCount == 1 )
                  return true;
      }
      return false;
}
The last column in the report grid in v.2.82 can be deactivated and you cannot change this behavior. The update above introduces a new __ERGS_ENABLE_DEACTIVATION_OF_LAST_COLUMN report grid style to use with the CExtReportGridWnd::ReportGridGetStyle() and CExtReportGridWnd::ReportGridModifyStyle() methods. This style turns on the last column behavior in style 2.82. By default it’s absent in 2.83 and you are unable to deactivate the last column.

Technical Support May 7, 2008 - 2:53 PM

Sorry please also update the following method:

bool CExtReportGridWnd::stat_cbItemClickForColumnVisibility(
      CExtPopupMenuWnd * pPopup,
      LPVOID pItemData
      )
{
      ASSERT_VALID( pPopup );
      pPopup;
      ASSERT( pItemData != NULL );
CExtPopupMenuWnd::MENUITEMDATA & mi =
            *((CExtPopupMenuWnd::MENUITEMDATA *)pItemData);
      ASSERT( mi.IsExtraMark() );
bool bActivate = ! mi.IsExtraChecked();
CExtReportGridColumn * pRGC = (CExtReportGridColumn*)mi.LParamGet();
      ASSERT_VALID( pRGC );
      ASSERT_KINDOF( CExtReportGridColumn, pRGC );
CExtReportGridWnd * pRGW = pRGC->GetReportGrid();

      if( ! bActivate )
      {
            bool bDeactivate = true;
            DWORD dwReportGridStyle = pRGW->ReportGridGetStyle();
            if( ( dwReportGridStyle & __ERGS_ENABLE_DEACTIVATION_OF_LAST_COLUMN ) == 0 )
            {
                  LONG nActiveColCount = pRGW->ReportColumnGetCount( true, false );
                  if( nActiveColCount == 1 )
                        bDeactivate = false;
            }
            if( ! bDeactivate )
                  return true; // not important
      }

      mi.SetExtraChecked( bActivate );

      pRGW->ReportColumnActivate( pRGC, bActivate, -1L, false );
      pRGW->OnSwUpdateScrollBars();
      pRGW->OnSwDoRedraw();
      return true; // not important
}