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 » CExtTabMdiWnd and right mouse button click Collapse All
Subject Author Date
Neville Franks Feb 14, 2005 - 12:35 AM

I want to handle right click on CExtTabMdiWnd (actually CExtTabMdiOneNoteWnd).


What is the best way to get this notification. For example should I derive a class from CExtTabMdiOneNoteWnd and add CMyTabWnd::OnRButtonUp() or is there a better way without having to create a derived class?

Technical Support Feb 14, 2005 - 7:38 AM

Just override the OnTabWndClickedItem virtual method as follows:

class CMyTabMdiOneNoteWnd: public CExtTabMdiOneNoteWnd
{
public:
    virtual bool OnTabWndClickedItem(
        LONG nItemIndex,
        bool bButtonPressed,
        INT nMouseButton,
        UINT nMouseEventFlags
    )
    {
        if( nMouseButton == MK_RBUTTON && (!bButtonPressed) )
        {
            TRACE1( "nItemIndex == %d\n", nItemIndex );
            SelectionSet( nItemIndex, true );
            return true;
        }
        return
            CExtTMWI < CExtTabOneNoteWnd >::OnTabWndClickedItem(
                nItemIndex,
                bButtonPressed,
                nMouseButton,
                nMouseEventFlags
                );
    }
};