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 » CExtTabPageContainerFlatWnd Context Menu Collapse All
Subject Author Date
Jeff Mayo Mar 10, 2011 - 1:44 PM

I want to show a context menu when the user right clicks in the tab strip. Adding a button to the strip is a possible alternative method.

Technical Support Mar 13, 2011 - 11:42 AM

Please create your own tabs class derived from CExtTWPC < CExtTabFlatWnd > and handle the WM_RBUTTONDOWN message in it:

class CYourFlatTabWnd : public CExtTWPC < CExtTabFlatWnd >
{
protected:
    virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
    {
        switch( message )
        {
        case WM_RBUTTONDOWN:
            {
                CPoint point( LOWORD(lParam), HIWORD(lParam) );
                int nTabItemIndex = ItemHitTest( point );
                if( nTabItemIndex < 0 )
                    return 0L; // not on tab item
. . . . . . . .
            }
        return 0L;
        }
        return CExtTWPC < CExtTabFlatWnd > :: WindowProc( message, wParam, lParam );
    }
};
Then you should override the <codeOnTabWndGetTabImpl()</code> virtual method so that the flat tab page container can use that tab control:
class CExtTabPageContainerFlatWnd : public CExtTabPageContainerWnd
{
public:
    virtual CExtTabWnd* OnTabWndGetTabImpl()
    {
        return new CYourFlatTabWnd;
    }
};    

Jeff Mayo Mar 16, 2011 - 9:27 AM

This change worked, thanks.

Jeff Mayo Mar 11, 2011 - 6:00 AM

I don’t get a notification of the WM_CONTEXTMENU message in the class that inherits from CExtTabPageContainerFlatWnd.