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 » CExtTabWnd: Highlight tab Collapse All
Subject Author Date
Jonas Gauffin Sep 27, 2006 - 6:38 AM

I’m using the following code to highlight a tab (in a class derived from CExtTabWnd):

        virtual void OnTabWndDrawItem(
            CDC & dc,
            CRect & rcTabItemsArea,
            LONG nItemIndex,
            TAB_ITEM_INFO * pTii,
            bool bTopLeft,
            bool bHorz,
            bool bSelected,
            bool bCenteredText,
            bool bGroupedMode,
            bool bInGroupActive,
            bool bInvertedVerticalMode,
            const CRect & rcEntireItem,
            CSize sizeTextMeasured,
            CFont * pFont,
            __EXT_MFC_SAFE_LPCTSTR sText,
            CExtCmdIcon * pIcon
            )
        {
            // Let’s put changed tabs in red.
            if (m_pParent->FindChangedTab(nItemIndex) != m_pParent->m_changedTabs.end())
            {
                /* this code did not work at all
                COLORREF prevcolor = dc.SetTextColor(RGB(255,0,0));
                CExtTabWnd::OnTabWndDrawItem(dc, rcTabItemsArea, nItemIndex, pTii, bTopLeft,
                    bHorz, bSelected, bCenteredText, bGroupedMode, bInGroupActive, bInvertedVerticalMode,
                    rcEntireItem, sizeTextMeasured, pFont, sText, pIcon);
                dc.SetTextColor(prevcolor);
                */
                if( (pTii->GetItemStyle() & __ETWI_CENTERED_TEXT) != 0 )
                    bCenteredText = true;

                PmBridge_GetPM()->PaintTabItem(
                    dc,
                    rcTabItemsArea,
                    bTopLeft,
                    bHorz,
                    bSelected,
                    bCenteredText,
                    bGroupedMode,
                    bInGroupActive,
                    bInvertedVerticalMode,
                    rcEntireItem,
                    sizeTextMeasured,
                    pFont,
                    sText,
                    pIcon,
                    this,
                    nItemIndex,
                    RGB(255,0,0));
            }
            else
                CExtTabWnd::OnTabWndDrawItem(dc, rcTabItemsArea, nItemIndex, pTii, bTopLeft,
                    bHorz, bSelected, bCenteredText, bGroupedMode, bInGroupActive, bInvertedVerticalMode,
                    rcEntireItem, sizeTextMeasured, pFont, sText, pIcon);

        }

It works fine when not using skins, but do not work with skins.
How can I get it to work with both?

One or more tabs can be flagged as "changed" and therfore getting a red text.

Technical Support Sep 28, 2006 - 11:40 AM

This approach cannot be used to colorize tab item’s text. We can regard your question as a feature request and add the text color as a property of any tab item.

Jonas Gauffin Sep 28, 2006 - 12:06 PM

It works when not using skins. But i need to use skins. I dont mind a "hack" to get it working, i need this feature.