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 » H-scrolling problem. Collapse All
Subject Author Date
Krustys Donuts May 19, 2008 - 9:42 AM


 


In regards to my May 16, 2008 - 3:10 PM question: After further testing, I found that overriding  the OnGbwDataDndIsAllowed method and returning a value of true causes the scrolling problem described in the initial email.  If I comment out this function, clicking on a cell in the far right column does not auto-scroll to the 1st column of the grid. Any thoughts?




As well, my tree grid has two layers of nodes. As it is now, when I double-click anywhere on the row of the top node, the node is collapsed or expanded. It there any way to limit the collapse/expand functionallity to the plus/minus button?




 




Gil


 


Krustys Donuts May 21, 2008 - 4:19 PM

Is the fix to the CExtGridBaseWnd::OnLButtonUp method going to be in the next release of the Prof-UIS?

Technical Support May 22, 2008 - 12:18 PM

Yes.

Technical Support May 19, 2008 - 11:42 AM

You came across the really interesting issue related to the unexpected horizontal scrolling in the drag-n-drop enabled tree grid window. To fix it, please update the source code for the CExtGridBaseWnd::OnLButtonUp() method in the ../Prof-UIS/Src/ExtGridWnd.cpp file:

void CExtGridBaseWnd::OnLButtonUp(UINT nFlags, CPoint point) 
{
      ASSERT_VALID( this );
      if( OnGbwDataDndIsAllowed() && m_eMTT == __EMTT_DATA_DND_STARTING )
      {
            SendMessage( WM_CANCELMODE );
            bool bAlt = ( (::GetAsyncKeyState(VK_MENU)&0x8000) != 0 ) ? true : false;
            bool bCtrl = ( (::GetAsyncKeyState(VK_CONTROL)&0x8000) != 0 ) ? true : false;
            bool bShift = ( (::GetAsyncKeyState(VK_SHIFT)&0x8000) != 0 ) ? true : false;
            bool bCtrlOnly = bCtrl && (!bAlt) && (!bShift);
            bool bShiftOnly = (!bCtrl) && (!bAlt) && bShift;
            bool bNoModifiers = (!bCtrl) && (!bAlt) && (!bShift);
            bool bMultiAreaSelection = MultiAreaSelectionGet();
            bool bReplaceOldSelection =
                        (!bMultiAreaSelection)
                  ||    (!(bCtrlOnly || bShiftOnly));
            if( ! ( bCtrlOnly || bNoModifiers ) )
                  return;
            CExtGridHitTestInfo htInfo( point );
            HitTest( htInfo, false, true );
            DWORD dwSiwStyles = SiwGetStyle();
            if(         (dwSiwStyles & __EGBS_SFB_MASK) != __EGBS_SFB_NONE
                  &&    ( htInfo.m_nColNo >= 0 || htInfo.m_nRowNo >= 0 )
                  )
            { // if any selection mode can be tracked
                  if( (htInfo.m_dwAreaFlags & __EGBWA_INNER_CELLS) != 0 )
                  {
                        LONG nColumnCount = ColumnCountGet();
                        LONG nRowCount = RowCountGet();
                        if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_COLUMNS )
                        {
                              if( htInfo.m_nColNo >= 0 )
                              {
                                    if( bNoModifiers )
                                    {
                                          CPoint ptNewFocus( htInfo.m_nColNo, htInfo.m_nRowNo );
                                          SelectionSet( ptNewFocus, true, false, false );
                                          FocusSet( ptNewFocus, true, true, false, false );
                                          OnSwDoRedraw();
                                          return;
                                    } // if( bNoModifiers )
                                    ASSERT( bCtrlOnly );
                                    if(         (dwSiwStyles & __EGBS_SFM_COLUMNS) == 0
                                          ||    (! SelectionGetForCell( htInfo.m_nColNo, 0 ) )
                                          ||    bReplaceOldSelection
                                          )
                                          return; // processed in WM_LBUTTONDOWN
                                    CRect rcSelection( htInfo.m_nColNo, 0, htInfo.m_nColNo, nRowCount-1 );
                                    SelectionSet( rcSelection, bReplaceOldSelection, false, false );
                                    EnsureVisibleColumn( htInfo.m_nColNo, true );
                              } // if( htInfo.m_nColNo >= 0 )
                              return;
                        } // if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_COLUMNS )
                        else if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_ROWS )
                        {
                              if( htInfo.m_nRowNo >= 0 )
                              {
                                    if( bNoModifiers )
                                    {
                                          CPoint ptNewFocus( htInfo.m_nColNo, htInfo.m_nRowNo );
                                          SelectionSet( ptNewFocus, true, false, false );
                                          FocusSet( ptNewFocus, true, true, false, false );
                                          OnSwDoRedraw();
                                          return;
                                    } // if( bNoModifiers )
                                    ASSERT( bCtrlOnly );
                                    if(         (dwSiwStyles & __EGBS_SFM_ROWS) == 0
                                          ||    (! SelectionGetForCell( 0, htInfo.m_nRowNo ) )
                                          ||    bReplaceOldSelection
                                          )
                                          return; // processed in WM_LBUTTONDOWN
                                    CRect rcSelection( 0, htInfo.m_nRowNo, nColumnCount-1, htInfo.m_nRowNo );
                                    SelectionSet( rcSelection, bReplaceOldSelection, false, false );
                                    EnsureVisibleRow( htInfo.m_nRowNo, true );
                              } // if( htInfo.m_nRowNo >= 0 )
                              return;
                        } // else if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_ROWS )
                        else
                        {
                              ASSERT( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_CELLS );
                              DWORD dwScrollTypeH = SiwScrollTypeHGet();
                              DWORD dwScrollTypeV = SiwScrollTypeVGet();
                              if(         0 <= htInfo.m_nColNo && (htInfo.m_nColNo < nColumnCount || dwScrollTypeH == __ESIW_ST_VIRTUAL )
                                    &&    0 <= htInfo.m_nRowNo && (htInfo.m_nRowNo < nRowCount || dwScrollTypeV == __ESIW_ST_VIRTUAL )
                                    )
                              { // if column and row numbers specified
                                    if( bNoModifiers )
                                    {
                                          CPoint ptNewFocus( htInfo.m_nColNo, htInfo.m_nRowNo );
                                          SelectionSet( ptNewFocus, true, false, false );
                                          FocusSet( ptNewFocus, true, true, false, false );
                                          OnSwDoRedraw();
                                          return;
                                    } // if( bNoModifiers )
                                    ASSERT( bCtrlOnly );
                                    if(         (dwSiwStyles&(__EGBS_SFM_COLUMNS|__EGBS_SFM_ROWS)) == 0
                                          ||    (! SelectionGetForCell( htInfo.m_nColNo, htInfo.m_nRowNo ) )
                                          ||    bReplaceOldSelection
                                          )
                                          return; // processed in WM_LBUTTONDOWN
                                    CPoint ptNewFocus( htInfo.m_nColNo, htInfo.m_nRowNo );
                                    if( ! AutoFocusBottomRightGet() )
                                          FocusSet( ptNewFocus, true, true, false, false );
                                    SelectionSet( ptNewFocus, false, false, true );
                                    return;
                              } // if column and row numbers specified
                        } // else from else if( (dwSiwStyles & __EGBS_SFB_MASK) == __EGBS_SFB_FULL_ROWS )
                  } // if( (htInfo.m_dwAreaFlags & __EGBWA_INNER_CELLS) != 0 )
            } // if any selection mode can be tracked
            return;
      } // if( OnGbwDataDndIsAllowed() && m_eMTT == __EMTT_DATA_DND_STARTING )
      if( m_eMTT != __EMTT_NOTHING )
            SendMessage( WM_CANCELMODE );
      if( OnGbwAnalyzeCellMouseClickEvent(VK_LBUTTON,0,nFlags,point) )
            return;
      CExtScrollItemWnd::OnLButtonUp(nFlags, point);
}
You can override the CExtGridBaseWnd::OnGbwAnalyzeCellMouseClickEvent() virtual method in your CExtTreeGridWnd-derived class so you can disable its row double click behavior:
bool CYourCustomTreeGridWnd::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 );
      ASSERT( 0 <= nRepCnt && nRepCnt <= 3 );
      if( nChar == VK_LBUTTON )
      {
            CExtGridHitTestInfo htInfo( point );
            HitTest( htInfo, false, true );
            if(         htInfo.IsHoverEmpty()
                  ||    (! htInfo.IsValidRect() )
                  )
                  return false;
            INT nColType = htInfo.GetInnerOuterTypeOfColumn();
            INT nRowType = htInfo.GetInnerOuterTypeOfRow();
            if(         nColType == 0
                  &&    nRowType == 0
                  )
            {
                  if(         (     nRepCnt == 1
                              &&    OnTreeGridQueryColumnOutline( htInfo.m_nColNo )
                              &&    (htInfo.m_dwAreaFlags&__EGBWA_TREE_OUTLINE_AREA) != 0
                              )
                        &&      (htInfo.m_dwAreaFlags&(__EGBWA_CELL_BUTTON|__EGBWA_CELL_CHECKBOX)) == 0
                        )
                  {
                        HTREEITEM hTreeItem = ItemGetByVisibleRowIndex( htInfo.m_nRowNo );
                        if(         (     nRepCnt == 2
                                    &&    hTreeItem != NULL
                                    &&    ItemGetChildCount( hTreeItem ) > 0
                                    )
                              ||    (htInfo.m_dwAreaFlags&__EGBWA_TREE_BOX) != 0
                              )
                        {
                              OnTreeGridToggleItemExpandedState(
                                    htInfo.m_nRowNo,
                                    &htInfo
                                    );
                              return true;
                        }
                  }
            }
      } // if( nChar == VK_LBUTTON && ( nRepCnt == 1 || nRepCnt == 2 ) )
      if( nRepCnt == 2 )
            return
                  CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent( // not CExtTreeGridWnd
                        nChar,
                        nRepCnt,
                        nFlags,
                        point
                        );
      return
            CExtTreeGridWnd::OnGbwAnalyzeCellMouseClickEvent(
                  nChar,
                  nRepCnt,
                  nFlags,
                  point
                  );
}