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 General Discussion » Issue with scroll bar in the menu's control in Prof-UIS 2.83. (StyleEditor sample) Collapse All
Subject Author Date
Viktor Korol Sep 12, 2008 - 7:02 AM

1. Run the StyleEditor sample.

2. Click the Style->Font (or Style or Size) menu item.

3. Click by left mouse button on the thumb of the scroll-bar holding down the button move the mouse pointer over the menu’s window.

4. Application crashes.



If comment PeekMessage call in the next code then scroll works properly.



void CExtScrollBar::ScrollBar_TrackMouseLButtonDown(

    MSG * pMSG

    )

{

...

        case WM_MOUSEMOVE:

            if( m_nSBMHT == INT(CExtPaintManager::__ESBMHT_THUMB)  )

            {

                if(        ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON,true) )

                    ||    CExtPopupMenuWnd::IsKeyPressed(VK_MBUTTON)

                    ||    CExtPopupMenuWnd::IsKeyPressed(VK_RBUTTON)

                    ||    ( (!bMenuMode) && CExtPopupMenuWnd::IsMenuTracking() )

                    )

                {

                    bStopFlag = true;

                    break;

                }

                PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);

                bAnalyzeThumb = true;

                ::GetCursorPos( &ptCursor );

                ::ScreenToClient( hWndOwn, &ptCursor );

                break;

            } // if( m_nSBMHT == INT(CExtPaintManager::__ESBMHT_THUMB)  )

            if( nStepSize == 0 )

                break;

...

}



Can I apply this fix without detriment to Prof-UIS functionality?

Technical Support Sep 12, 2008 - 1:41 PM

Thank you for reporting this issue. To fix it, please update the source code for the following method:

bool CExtPopupControlMenuWnd::_OnMouseMove(
      UINT nFlags,
      CPoint point,
      bool & bNoEat
      )
{
      ASSERT_VALID( this );

      if( GetSafeHwnd() == NULL )
            return false;

      if( GetSite().GetAnimated() != NULL )
            return true;

      if( _IsResizingMode() )
      {
            bNoEat = true;
            return false;
      }

CExtPopupMenuSite & _site = GetSite();
      if(   _site.IsShutdownMode()
            || _site.IsEmpty()
            || _site.GetAnimated() != NULL
            )
            return true;

TranslateMouseMoveEventData_t _td( this, nFlags, point, bNoEat );
      if( _td.Notify() )
      {
            bNoEat = _td.m_bNoEat;
            return true;
      }

CPoint ptScreenClick( point );
      ClientToScreen( &ptScreenClick );

bool bRetVal = false;
      if(         m_hWndChildControl != NULL
            &&    ::IsWindow( m_hWndChildControl )
            )
      {
            CPoint ptControlClient = ptScreenClick;
            ::ScreenToClient( m_hWndChildControl, &ptControlClient );
            CONTROLINPUTRETRANSLATEINFO _ciri(
                  this,
                  true,
                  nFlags,
                  ptControlClient, // point,
                  bNoEat
                  );
            bRetVal = 
                  ( ::SendMessage(
                        m_hWndChildControl,
                        g_nMsgControlInputRetranslate,
                        (WPARAM)(&_ciri),
                        (LPARAM)0L
                        ) != 0 )
                  ? true : false;
      }

HWND hWndFromPoint = ::WindowFromPoint( ptScreenClick );
      if(         hWndFromPoint != NULL
            &&    (::__EXT_MFC_GetWindowLong(hWndFromPoint,GWL_STYLE)&WS_CHILD) != 0
            &&    (     m_hWndChildControl == hWndFromPoint
                  ||    ::IsChild( m_hWndChildControl, hWndFromPoint )
                  )
            )
      {
            bNoEat = true;
            return false;
      }
HWND hWndFocus = ::GetFocus();
      if(         hWndFocus != NULL
            &&    (::__EXT_MFC_GetWindowLong(hWndFocus,GWL_STYLE)&WS_CHILD) != 0
            &&    (     m_hWndChildControl == hWndFocus
                  ||    ::IsChild( m_hWndChildControl, hWndFocus )
                  )
            )
      {
            bNoEat = true;
            return false;
      }
HWND hWndCapture = ::GetCapture();
      if( hWndCapture != NULL )
      {
            CWnd * pWndPermanent = CWnd::FromHandlePermanent( hWndCapture );
            if( pWndPermanent != NULL )
            {
                  if( pWndPermanent->IsKindOf( RUNTIME_CLASS(CScrollBar) ) )
                  {
                        bNoEat = true;
                        return false;
                  }
            }
            if(         (::__EXT_MFC_GetWindowLong(hWndCapture,GWL_STYLE)&WS_CHILD) != 0
                  &&    (     m_hWndChildControl == hWndCapture
                        ||    ::IsChild( m_hWndChildControl, hWndCapture )
                        )
                  )
            {
                  bNoEat = true;
                  return false;
            }
      }

      if( (! bRetVal ) && (! _PtInWndArea( point ) ) )
      {
            if( _CoolTipIsVisible() )
            {
                  _CoolTipHide( false );
                  Invalidate();
            }
            if( m_pWndParentMenu != NULL
                  && m_pWndParentMenu->GetSafeHwnd() != NULL
                  )
            {
                  ASSERT_VALID( m_pWndParentMenu );
                  ClientToScreen( &point );
                  m_pWndParentMenu->ScreenToClient( &point );
                  if( m_pWndParentMenu->_OnMouseMove(
                              nFlags,
                              point,
                              bNoEat
                              )
                        )
                  {
                        if( bNoEat )
                              return false;
                        _OnCancelMode();
                        return true;
                  }
            }
            return false;
      } // if( (! bRetVal ) && (! _PtInWndArea( point ) ) )
      else
      {
            if( _IsTearOff() )
            {
                  if( CExtPopupMenuWnd::_HitTest(point) != IDX_TEAROFF )
                        Invalidate();
            }
      } // else from if( (! bRetVal ) && (! _PtInWndArea( point ) ) )

      if( _IsTearOff() )
      {
            if( CExtPopupMenuWnd::_HitTest(point) == IDX_TEAROFF )
            {
                  HWND hWndOwn = m_hWnd;
                  _ItemFocusCancel( TRUE, FALSE );
                  if( ! ::IsWindow( hWndOwn ) )
                        return true;
                  _SetCapture();
                  HCURSOR hCursor = ::LoadCursor( NULL, IDC_SIZEALL );
                  ASSERT( hCursor != NULL );
                  ::SetCursor( hCursor );
                  if(         g_bMenuShowCoolTips
                        &&    GetSite().GetCapture() == this
                        )
                  {
                        CRect rcItem;
                        _GetItemRect(IDX_TEAROFF,rcItem);
                        ClientToScreen( &rcItem );
                        bool bShowTip = true;
                        CExtPopupMenuTipWnd & _tipWnd = GetTip();
                        if( _tipWnd.GetSafeHwnd() != NULL )
                        {
                              CRect rcExcludeArea = _tipWnd.GetExcludeArea();
                              if( rcExcludeArea == rcItem )
                                    bShowTip = false;
                        }
                        if( bShowTip )
                        {
                              CExtSafeString sTipText;
                              g_ResourceManager->LoadString( sTipText, ID_EXT_TEAR_OFF_MENU_TIP );
                              if( sTipText.IsEmpty() )
                                    sTipText = _T("Drag to make this menu float");

                              _tipWnd.SetText( sTipText );
                              VERIFY(
                                    _tipWnd.Show(
                                          this,
                                          rcItem
                                          )
                                    );
                        }
                  }
                  return true;
            }
            _CoolTipHide( false );
            HCURSOR hCursor = ::LoadCursor( NULL, IDC_ARROW );
            ASSERT( hCursor != NULL );
            ::SetCursor( hCursor );
            Invalidate();
      }

      return bRetVal;
}