Professional UI Solutions
Site Map   /  Register


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 » Handle click in tab list (CExtTabWnd) Collapse All
Subject Author Date
Julien Garcia Mar 2, 2011 - 6:10 AM


I am using CExtTabWnd & CExtTabPageContainerWnd to display tabs.

I can handle click on a tab item by overriding "OnTabWndClickedItem" function.

I can handle click on "Close" and "Help buttons on the tab area of the page container by overriding OnTabWndClickedButton.

But I can’t find how to handle click (more precisely a right click) on a tab item in the tab list.

What I want is to display a popup menu when right clicking a tab item in this list (the same popup menu that I display when I right click the tab item with "OnTabWndClickedItem" function.

For example (see screenshot below), how can I handle a right click on the "TreeCtrl" item.

Thank you in advance for any help


Technical Support Mar 4, 2011 - 10:29 AM

You should handle the CExtPopupBaseWnd::g_nMsgTranslateMouseClickEvent registered message in your tab window class:


LRESULT CYourTabWnd::OnMsgTranslateMouseClickEvent(WPARAM wParam, LPARAM lParam)
    ASSERT_VALID( this ); wParam; lParam;
#ifdef _DEBUG
CExtPopupBaseWnd::TranslateMouseClickEventData_t * pData = (CExtPopupBaseWnd::TranslateMouseClickEventData_t*)wParam;
    ASSERT( pData != NULL );
    if( pData->m_nFlags == WM_LBUTTONDOWN )
        afxDump << "WM_LBUTTONDOWN\r\n";
    if( pData->m_nFlags == WM_MBUTTONDOWN )
        afxDump << "WM_MBUTTONDOWN\r\n";
    if( pData->m_nFlags == WM_RBUTTONDOWN )
        afxDump << "WM_RBUTTONDOWN\r\n";
#endif // _DEBUG
    return 0L;

Julien Garcia Mar 7, 2011 - 6:21 AM


Indeed, overriding "OnMsgTranslateMouseClickEvent" in my tab window class allows me to catch right click events in the vertical list of tabs.

Now, can I know which tab item has been clicked (by getting its index for example)?

I saw the attribute m_point in the pData pointer, but I can’t figure how to get the index info (except dividing m_point.y by the height in pixels of a popup menu item ?).

Thank you in advance for any help

Technical Support Mar 10, 2011 - 11:06 AM

Menu items have an order of tab items. Menu item identifiers are computed as 0xffff plus tab item index. The CExtPopupMenuWnd::_HitTest() method allows you to hit test menu items. Please note menu items with zero command identifiers are separators.

Julien Garcia Mar 3, 2011 - 9:03 AM


Thank you, but handling "ON_WM_RBUTTONDOWN" in my CExtTabWnd derivated class does not seem to work.

I do not enter in the function "OnRButtonDown((UINT nFlags, CPoint point)" when right clicking a tab item from the right vertical list of tabs (see screenshot below). This work only when i right click a tab item in the horizontal list.

I’m using version 2.64 of Prof-UIS.

Thank you in advance for any help

Technical Support Mar 3, 2011 - 7:58 AM

You should handle the WM_RBUTTONDOWN message in the tab window and perform tab item hit testing using the CExtTabWnd::ItemHitTest() method.