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 » Problem with ZoomScrollBar Sample Collapse All
Subject Author Date
WookJong Yu Jul 31, 2007 - 2:10 AM

To whom it may concern

Hello. I am one of the developers in a software
company in Korea called Daulsoft.
I have a slight problem.
I have used the ZoomScrollBar sample and
there seems to be a problem. When zoom in button is
clicked several times and I would like change to
"zoom out", it zooms in one more time and then starts
to zoom out. It is the same vise versa. When "zoom out’ button is clicked several times and I would like to
zoom in, I click on the "zoom in" button and once again, the map image zooms out once and then starts to zoom in.

The period for support has ended. However, if this problem can be solved, then we intend to purchase User license again (Prof-UIS v.2.80).

Please respond me back as soon as possible to the following email :

jcahn@daulsoft.com

Thank you.

Technical Support Jul 31, 2007 - 11:29 AM

Thank you for reporting this issue. Please update the source code for the following method:

void CExtScrollBar::OnLButtonDown(UINT nFlags, CPoint point)
{
      ASSERT_VALID( this );
      if( ! m_bCompleteRepaint )
      {
            CScrollBar::OnLButtonDown( nFlags, point );
            return;
      }
CExtPopupMenuTipWnd * pATTW =
            OnAdvancedPopupMenuTipWndGet();
CExtPaintManager::PAINTSCROLLBARDATA _psbd( this );
      _psbd.AdjustHT( point );
      if(         (! m_bProcessingHover)
            ||    m_bProcessingClick
            ||    (! _psbd.m_bEnabled )
            ||    _psbd.m_eSBMHT == CExtPaintManager::__ESBMHT_NOWHERE
            )
      {
            if(         _psbd.m_eSBMHT == CExtPaintManager::__ESBMHT_NOWHERE
                  ||    (! _psbd.m_bEnabled )
                  )
            {
                  if( pATTW != NULL )
                        pATTW->Hide();
                  SendMessage( WM_CANCELMODE );
                  Invalidate();
                  UpdateWindow();
                  return;
            }
      }
      ActivateTopParent();
bool bAnimationLocked = AnimationClient_CacheGeneratorIsLocked();
      if( ! bAnimationLocked )
      {
            AnimationClient_CacheGeneratorLock();
            AnimationClient_CacheNextStateMinInfo(
                  false,
                  __EAPT_BY_PRESSED_STATE_TURNED_ON
                  );
      }
      m_nSBMHT = INT(_psbd.m_eSBMHT);
      m_bProcessingClick = m_bProcessingHover = true;
      m_bProcessingOutClick = false;
      if( ! bAnimationLocked )
      {
            AnimationClient_CacheNextStateMinInfo(
                  true,
                  __EAPT_BY_PRESSED_STATE_TURNED_ON
                  );
            AnimationClient_CacheGeneratorUnlock();
      }
      Invalidate();
      UpdateWindow();
      if( pATTW != NULL )
            OnAdvancedPopupMenuTipWndDisplay( *pATTW, m_nSBMHT, true );
INT nScrollPosStart = _psbd.m_DSI.nPos, nScrollPos = _psbd.m_DSI.nPos;
      m_nHelperTrackPos = _psbd.m_DSI.nPos;
      m_bHelperHaveTrackPos = true;
CRect rcArea = _psbd.GetAreaRectHT();
const UINT nTimerID = 401;
const UINT nTimerEllapse = 100;
HWND hWndOwn = GetSafeHwnd();
      ASSERT( hWndOwn != NULL && ::IsWindow( hWndOwn ) );
HWND hWndParent = ::GetParent( hWndOwn );
bool bVirtualMode = false, bFinalNotify = true;
#if (!defined __EXT_MFC_NO_SCROLLITEMWND)
      if( hWndParent != NULL )
      {
            CWnd * pWndParentPermanent = CWnd::FromHandlePermanent( hWndParent );
            if( pWndParentPermanent != NULL )
            {
                  CExtScrollItemWnd * pExtScrollItemWnd =
                        DYNAMIC_DOWNCAST(
                              CExtScrollItemWnd,
                              pWndParentPermanent
                              );
                  if( pExtScrollItemWnd != NULL )
                  {
                        DWORD dwScrollType = __ESIW_ST_NONE;
                        if( _psbd.m_bHorzBar )
                              dwScrollType = pExtScrollItemWnd->SiwScrollTypeHGet();
                        else
                              dwScrollType = pExtScrollItemWnd->SiwScrollTypeVGet();
                        if( dwScrollType == __ESIW_ST_VIRTUAL )
                              bVirtualMode = true;
                  }
            }
      }
#endif
bool bStopFlag = false;
CPoint ptCursor( point );
INT nStepSize = 0L;
bool bUpStep = false;
      switch( _psbd.m_eSBMHT )
      {
      case CExtPaintManager::__ESBMHT_BUTTON_UP:
            bUpStep = true;
      case CExtPaintManager::__ESBMHT_BUTTON_DOWN:
            nStepSize = 1L;
            break;
      case CExtPaintManager::__ESBMHT_PAGE_UP:
            bUpStep = true;
      case CExtPaintManager::__ESBMHT_PAGE_DOWN:
            nStepSize = (INT)_psbd.m_DSI.nPage;
            if( nStepSize == 0L )
                  nStepSize = 1L;
            break;
      case CExtPaintManager::__ESBMHT_THUMB:
            break;
      }
bool bMenuMode = false;
      if( CExtPopupMenuWnd::IsMenuTracking() )
      {
            CExtPopupMenuWnd * pPopup = CExtPopupMenuSite::g_DefPopupMenuSite.GetInstance();
            if( pPopup != NULL )
            {
                  CWnd * pWnd = GetParent();
                  for( ; pWnd != NULL; pWnd = pWnd->GetParent() )
                  {
                        if( pWnd == pPopup )
                        {
                              bMenuMode = true;
                              break;
                        }
                  }
            }
      }
INT nMx = INT( _psbd.m_DSI.nMax - _psbd.m_DSI.nPage + 1 );
INT nScrollLimit =
              _psbd.m_DSI.nMax
            - _psbd.m_DSI.nMin
            - _psbd.m_DSI.nPage
            + 1
            ;
      ASSERT( nScrollLimit >= 0 );
      if( nStepSize > nScrollLimit )
            nStepSize = nScrollLimit;
CRect rcScrollable = _psbd.m_rcBar;
      if( _psbd.m_bHorzBar )
      {
            rcScrollable.left = _psbd.m_rcButtonUp.right;
            rcScrollable.right = _psbd.m_rcButtonDown.left;
      }
      else
      {
            rcScrollable.top = _psbd.m_rcButtonUp.bottom;
            rcScrollable.bottom = _psbd.m_rcButtonDown.top;
      }
      ::SetCapture( hWndOwn );
      if( nStepSize != 0L )
      {
            ::PostMessage( hWndOwn, WM_TIMER, WPARAM(nTimerID), LPARAM(0L) );
            ::SetTimer( hWndOwn, nTimerID, nTimerEllapse, NULL );
      }
      for( MSG msg; ::IsWindow( hWndOwn ) && (!bStopFlag); )
      {
            if( ! PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
            {
                  if( ! ::IsWindow( hWndOwn ) )
                        break;
                  ::WaitMessage();
                  continue;
            }

            bool bAnalyzeThumb = false;
            switch( msg.message )
            {
            case WM_LBUTTONDBLCLK:
            case WM_LBUTTONUP:
            case WM_RBUTTONDBLCLK:
            case WM_RBUTTONDOWN:
            case WM_RBUTTONUP:
            case WM_MBUTTONDBLCLK:
            case WM_MBUTTONDOWN:
            case WM_MBUTTONUP:
            case WM_CANCELMODE:
            case WM_ACTIVATEAPP:
            case WM_KEYDOWN:
            case WM_KEYUP:
                  bStopFlag = true;
            break;
            case WM_CAPTURECHANGED:
                  if( (HWND)msg.wParam != hWndOwn )
                        bStopFlag = true;
            break;
            case WM_MOUSEMOVE:
                  if( m_nSBMHT == INT(CExtPaintManager::__ESBMHT_THUMB) )
                  {
                        if(         ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON) )
                              ||    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( nStepSize == 0 )
                        break;
            case WM_TIMER:
                  {
                        if(         ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON) )
                              ||    CExtPopupMenuWnd::IsKeyPressed(VK_MBUTTON)
                              ||    CExtPopupMenuWnd::IsKeyPressed(VK_RBUTTON)
                              ||    ( (!bMenuMode) && CExtPopupMenuWnd::IsMenuTracking() )
                              )
                        {
                              bStopFlag = true;
                              break;
                        }
                        if( msg.message == WM_TIMER )
                        {
                              if( msg.wParam != nTimerID )
                                    break;
                        }
                        ASSERT( nStepSize != 0L );
                        PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
                        ::GetCursorPos( &ptCursor );
                        ::ScreenToClient( hWndOwn, &ptCursor );
                        if( ! rcArea.PtInRect(ptCursor) )
                        {
                              if( ! m_bProcessingOutClick )
                              {
                                    m_bProcessingOutClick = true;
                                    Invalidate();
                              }
                              if( pATTW != NULL )
                                    pATTW->Hide();
                              continue;
                        }
                        if( bUpStep )
                        {
                              nScrollPos -= nStepSize;
                              if( nScrollPos < _psbd.m_DSI.nMin )
                                    nScrollPos = _psbd.m_DSI.nMin;
                        }
                        else
                        {
                              nScrollPos += nStepSize;
                              if( nScrollPos > nMx )
                                    nScrollPos = nMx;
                        }
                        if( _GetScrollPos( true ) != nScrollPos )
                        {
                              bool bSendScrollingNotification = true, bTrackPos = false;
                              if( hWndParent != NULL )
                              {
                                    switch( m_nSBMHT )
                                    {
                                    case (CExtPaintManager::__ESBMHT_BUTTON_UP):
                                          bSendScrollingNotification = false;
                                          if( ! bVirtualMode )
                                                _SetScrollPos( nScrollPos, bTrackPos, true, bSendScrollingNotification );
                                          else
                                                bFinalNotify = false;
                                          ::SendMessage(
                                                hWndParent,
                                                _psbd.m_bHorzBar ? WM_HSCROLL : WM_VSCROLL,
                                                MAKEWPARAM(
                                                      ( _psbd.m_bHorzBar ? SB_LINELEFT : SB_LINEUP ),
                                                      0
                                                      ),
                                                LPARAM(m_hWnd)
                                                );
                                    break;
                                    case (CExtPaintManager::__ESBMHT_BUTTON_DOWN):
                                          bSendScrollingNotification = false;
                                          if( ! bVirtualMode )
                                                _SetScrollPos( nScrollPos, bTrackPos, true, bSendScrollingNotification );
                                          else
                                                bFinalNotify = false;
                                          ::SendMessage(
                                                hWndParent,
                                                _psbd.m_bHorzBar ? WM_HSCROLL : WM_VSCROLL,
                                                MAKEWPARAM(
                                                      ( _psbd.m_bHorzBar ? SB_LINERIGHT : SB_LINEDOWN ),
                                                      0
                                                      ),
                                                LPARAM(m_hWnd)
                                                );
                                    break;
                                    case (CExtPaintManager::__ESBMHT_PAGE_UP):
                                          bSendScrollingNotification = false;
                                          if( ! bVirtualMode )
                                                _SetScrollPos( nScrollPos, bTrackPos, true, bSendScrollingNotification );
                                          else
                                                bFinalNotify = false;
                                          ::SendMessage(
                                                hWndParent,
                                                _psbd.m_bHorzBar ? WM_HSCROLL : WM_VSCROLL,
                                                MAKEWPARAM(
                                                      ( _psbd.m_bHorzBar ? SB_PAGELEFT : SB_PAGEUP ),
                                                      0
                                                      ),
                                                LPARAM(m_hWnd)
                                                );
                                    break;
                                    case (CExtPaintManager::__ESBMHT_PAGE_DOWN):
                                          bSendScrollingNotification = false;
                                          if( ! bVirtualMode )
                                                _SetScrollPos( nScrollPos, bTrackPos, true, bSendScrollingNotification );
                                          else
                                                bFinalNotify = false;
                                          ::SendMessage(
                                                hWndParent,
                                                _psbd.m_bHorzBar ? WM_HSCROLL : WM_VSCROLL,
                                                MAKEWPARAM(
                                                      ( _psbd.m_bHorzBar ? SB_PAGERIGHT : SB_PAGEDOWN ),
                                                      0
                                                      ),
                                                LPARAM(m_hWnd)
                                                );
                                    break;
                                    case (CExtPaintManager::__ESBMHT_THUMB):
                                          bTrackPos = true;
                                    if( ! bVirtualMode )
                                          _SetScrollPos( nScrollPos, bTrackPos, true, bSendScrollingNotification );
                                    else
                                          bFinalNotify = false;
                                    break;
                                    }
                              }
                              if( pATTW != NULL && ( ! bAnalyzeThumb ) )
                                    OnAdvancedPopupMenuTipWndDisplay( *pATTW, m_nSBMHT, true );
                        }
                        _psbd.AdjustHT( ptCursor );
                        bool bProcessingOutClick =
                              ( m_nSBMHT == INT(_psbd.m_eSBMHT) )
                                    ? false : true;
                        rcArea = _psbd.GetAreaRect( CExtPaintManager::e_scroll_bar_mouse_hover_type_t(m_nSBMHT) );
                        if( m_bProcessingOutClick != bProcessingOutClick )
                        {
                              bool bAnimationLocked = AnimationClient_CacheGeneratorIsLocked();
                              if( ! bAnimationLocked )
                              {
                                    AnimationClient_CacheGeneratorLock();
                                    AnimationClient_CacheNextStateMinInfo(
                                          false,
                                          __EAPT_BY_PRESSED_STATE_TURNED_OFF
                                          );
                              }
                              m_bProcessingOutClick = bProcessingOutClick;
                              if( ! bAnimationLocked )
                              {
                                    AnimationClient_CacheNextStateMinInfo(
                                          true,
                                          __EAPT_BY_PRESSED_STATE_TURNED_OFF
                                          );
                                    AnimationClient_CacheGeneratorUnlock();
                              }
                              Invalidate();
                              UpdateWindow();
                        }
                  }
            break;
            default:
                  if(         ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON) )
                        ||    CExtPopupMenuWnd::IsKeyPressed(VK_MBUTTON)
                        ||    CExtPopupMenuWnd::IsKeyPressed(VK_RBUTTON)
                        ||    ( (!bMenuMode) && CExtPopupMenuWnd::IsMenuTracking() )
                        )
                        bStopFlag = true;
            break;
            }
            if( bStopFlag || nScrollLimit == 0L )
                  break;
            if( bAnalyzeThumb )
            {
                  LONG nPixelOffset = _psbd.m_bHorzBar
                        ? (ptCursor.x - point.x)
                        : (ptCursor.y - point.y);
                  LONG nPixelExtent = _psbd.m_bHorzBar
                        ? (rcScrollable.Width() - _psbd.m_rcThumb.Width())
                        : (rcScrollable.Height() - _psbd.m_rcThumb.Height());
                  if( nPixelExtent <= 0 )
                  {
                        bStopFlag = true;
                        break;
                  }
                  if( abs(nPixelOffset) > nPixelExtent )
                        nPixelOffset =
                              (nPixelOffset < 0)
                                    ? (-nPixelExtent)
                                    : nPixelExtent;
                  INT nShift =
                        ( nPixelExtent == 0 || nPixelOffset == 0 )
                              ? 0
                              : ::MulDiv( nScrollLimit, abs(nPixelOffset), nPixelExtent );
                  nScrollPos = nScrollPosStart;
                  if( nPixelOffset < 0 )
                  {
                        nScrollPos -= nShift;
                        if( nScrollPos < _psbd.m_DSI.nMin )
                              nScrollPos = _psbd.m_DSI.nMin;
                  }
                  else
                  {
                        nScrollPos += nShift;
                        if( nScrollPos > nMx )
                              nScrollPos = nMx;
                  }
                  if( ! bVirtualMode )
                  {
                        if( _GetScrollPos( true ) != nScrollPos )
                        {
                              _SetScrollPos( nScrollPos, true );
                              if( pATTW != NULL )
                                    OnAdvancedPopupMenuTipWndDisplay( *pATTW, m_nSBMHT, true );
                        }
                        bFinalNotify = true;
                  }
                  _psbd.AdjustHT( ptCursor );
                  rcArea = _psbd.GetAreaRect( CExtPaintManager::__ESBMHT_THUMB );
                  continue;
            }
            if( !AfxGetThread()->PumpMessage() )
                  break;
      }
      if( ! ::IsWindow( hWndOwn ) )
            return;
      if( nStepSize != 0L )
            ::KillTimer( hWndOwn, nTimerID );
      bAnimationLocked = AnimationClient_CacheGeneratorIsLocked();
      if( ! bAnimationLocked )
      {
            AnimationClient_CacheGeneratorLock();
            if( AnimationClient_StateGet(true).IsEmpty() )
                  AnimationClient_CacheNextStateMinInfo(
                        false,
                        __EAPT_BY_PRESSED_STATE_TURNED_OFF
                        );
      }
      if( bFinalNotify )
      {
            bool bSendScrollingNotification = true;
            switch( m_nSBMHT )
            {
            case (CExtPaintManager::__ESBMHT_BUTTON_UP):
            case (CExtPaintManager::__ESBMHT_BUTTON_DOWN):
            case (CExtPaintManager::__ESBMHT_PAGE_UP):
            case (CExtPaintManager::__ESBMHT_PAGE_DOWN):
                  bSendScrollingNotification = false;
            break;
            }
            _SetScrollPos( nScrollPos, false, true, bSendScrollingNotification );
      }
      m_nSBMHT = INT(CExtPaintManager::__ESBMHT_NOWHERE);
      m_bProcessingClick
            = m_bProcessingOutClick
            = m_bProcessingHover
            = false;
      if( ! bAnimationLocked )
      {
            ::GetCursorPos( &ptCursor );
            ScreenToClient( &ptCursor );
            _psbd.AdjustHT( ptCursor );
            m_nSBMHT = INT(_psbd.m_eSBMHT);
            AnimationClient_CacheNextStateMinInfo(
                  true,
                  __EAPT_BY_PRESSED_STATE_TURNED_OFF
                  );
            AnimationClient_CacheGeneratorUnlock();
      }
      Invalidate();
      UpdateWindow();
      m_nHelperTrackPos = -1;
      m_bHelperHaveTrackPos = false;
      if( ::GetCapture() == hWndOwn )
            ::ReleaseCapture();
      if( pATTW != NULL )
            OnAdvancedPopupMenuTipWndDisplay( *pATTW, INT(_psbd.m_eSBMHT), false );
}