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 » right click menu scrollbars. Collapse All
Subject Author Date
Dirk lindner Oct 26, 2009 - 9:54 AM

Hello,
is it possible to create a right click menu for styled scrollbars in prof-uis ?


Dirk Lindner

Dirk lindner Nov 9, 2009 - 4:52 AM

thank you !
works fine ;)

Dirk Lindner

Technical Support Oct 26, 2009 - 2:17 PM

The scroll bar’s context menu can be enabled by updating the source code for the following 3 methods:

void CExtScrollBar::OnContextMenu(CWnd* pWnd, CPoint point)
{
            ASSERT_VALID( this );
            CScrollBar::OnContextMenu( pWnd, point );
}

void CExtScrollBar::OnRButtonDown(UINT nFlags, CPoint point)
{
            ASSERT_VALID( this );
            if( ! m_bCompleteRepaint )
            {
                        CScrollBar::OnRButtonDown( nFlags, point );
                        return;
            }
MSG _msg;
            ::memset( &_msg, 0, sizeof(MSG) );
            _msg.hwnd = m_hWnd;
    _msg.message = WM_RBUTTONDOWN;
    _msg.wParam = WPARAM(nFlags);
    _msg.lParam = MAKELPARAM( point.x ,point.y );
            if( ! ScrollBar_OnMouseClickMsg( &_msg ) )
                        CScrollBar::OnRButtonDown( nFlags, point );
}

bool CExtScrollBar::ScrollBar_OnMouseClickMsg(
            MSG * pMSG
            )
{
            ASSERT_VALID( this );
            ASSERT( pMSG != NULL );
bool bRetVal = true;
bool bRightClickMsg = false;
            switch( pMSG->message )
            {
            case WM_LBUTTONDOWN:
                        ScrollBar_TrackMouseLButtonDown( pMSG );
            break;
            case WM_RBUTTONDOWN:
                        bRightClickMsg = true;
            case WM_RBUTTONUP:
            case WM_RBUTTONDBLCLK:
                        //bRetVal = false;
            case WM_LBUTTONUP:
            case WM_LBUTTONDBLCLK:
            case WM_MBUTTONDOWN:
            case WM_MBUTTONUP:
            case WM_MBUTTONDBLCLK:
            {
                        CExtPopupMenuTipWnd * pATTW =
                                    OnAdvancedPopupMenuTipWndGet();
                        if( pATTW != NULL )
                                    pATTW->Hide();
                        if( bRightClickMsg )
                        {
                                    POINT pt;
                                    ::GetCursorPos( &pt );
                                    SendMessage( WM_CONTEXTMENU, WPARAM(m_hWnd), MAKELPARAM(pt.x,pt.y) );
                        }
            }
            break;
            default:
                        bRetVal = false;
            break;
            } // switch( pMSG->message )
            return bRetVal;
}
And all the commands of this context menu work correctly because the CExtScrollBar class has the same part sizes as the scroll bar common control. But the Scroll Here menu command causes repainting of the scroll bar common control in the default windows style. The scroll bar common control is very specific. Like all the other old common controls introduced before Windows 95, this common control changes its state without any notification messages. It also repaints itself not via the standard WM_PAINT message. Prof-UIS completely handles all the mouse and keyboard messages of all the old common controls present in Windows 3x. We cannot enable the default scroll bar’s context menu. But we can assume your message as a feature request. We will need to code our own context menu and ask our translators to translate it.