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 » About CExtGrid Collapse All
Subject Author Date
tera t Oct 31, 2007 - 2:10 AM

hello

When I clicked the check box of the grid.
http://www.yukai.jp/~ifreeta/20071031/image01.jpg

A selection does not want to come off.

Technical Support Nov 1, 2007 - 8:34 AM

The following class implements a grid window which can lock focus and selection changing and does this when the user clicks on the built-in cell’s check boxes:

class CYourGridWnd : public CExtGridWnd
{
public:
      bool m_bLockSelectionSetting:1, m_bLockFocusSetting:1;
      CYourGridWnd()
            : m_bLockSelectionSetting( false )
            , m_bLockFocusSetting( false )
      {
      }
      virtual CPoint FocusSet(
            const POINT & ptNewFocus,
            bool bEnsureVisibleColumn = true,
            bool bEnsureVisibleRow = true,
            bool bResetSelectionToFocus = true,
            bool bRedraw = true,
            bool * p_bCanceled = NULL
            )
      {
            ASSERT_VALID( this );
            if( m_bLockFocusSetting )
                  return FocusGet();
            return CExtGridWnd::FocusSet( ptNewFocus, bEnsureVisibleColumn, bEnsureVisibleRow, bResetSelectionToFocus, bRedraw, p_bCanceled );
      }
      virtual bool SelectionSet(
            const RECT & rcNewSelection,
            bool bReplaceOldAreas = true,
            bool bReplaceLastArea = false,
            bool bRedraw = true
            )
      {
            ASSERT_VALID( this );
            if( m_bLockSelectionSetting )
                  return true;
            return CExtGridWnd::SelectionSet( rcNewSelection, bReplaceOldAreas, bReplaceLastArea, bRedraw );
      }
      virtual bool OnGbwAnalyzeCellMouseClickEvent(
            UINT nChar, // VK_LBUTTON, VK_RBUTTON or VK_MBUTTON only
            UINT nRepCnt, // 0 - button up, 1 - single click, 2 - double click, 3 - post single click & begin editing
            UINT nFlags, // mouse event flags
            CPoint point // mouse pointer in client coordinates
            )
      {
            ASSERT_VALID( this );
            CExtGridHitTestInfo htInfo( point );
            HitTest( htInfo, false, true );
            if(         (! htInfo.IsHoverEmpty() )
                  &&    htInfo.IsValidRect()
                  &&    ( htInfo.m_dwAreaFlags & __EGBWA_CELL_CHECKBOX ) != 0 
                  )
                  m_bLockFocusSetting = m_bLockSelectionSetting = true;
            bool bRetVal = CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point );
            m_bLockFocusSetting = m_bLockSelectionSetting = false;
            return bRetVal;
      }
};


tera t Nov 1, 2007 - 6:37 PM

Hello

Thank you !!