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::OnTabWndDrawItem Collapse All
Subject Author Date
Mac Will Dec 15, 2005 - 4:23 PM

Hello,


I am overriding the function CExtTabWnd::OnTabWndDrawItem because I want my tabs to have some blank space in them.  Basically I increase the size of rcEntireItem to what I want than call the real CExtTabWnd::OnTabWndDrawItem.

The problem is not that this isn’t working, it’s that the area definition of the tabs doesn’t changed.  Basically they look big but when it comes to clicking the mouse the areas are what they would have been if I hadn’t made them bigger.

Any help.

I also tried overriding CExtTabWnd::OnTabWndItemInsert and putting the following code in it but still no success:


CRect my_rect = pTii->ItemRectGet();


if(nItemIndex == 0)


my_rect.InflateRect(0,0,50,0);


else


my_rect.InflateRect(-(50*nItemIndex),0,((50*nItemIndex)+50),0);


pTii->ItemRectSet(my_rect);


 


Here is my class, Thanks!


CExtCmdIcon * CIOSTabCtrl::OnTabWndQueryItemIcon(


const CExtTabWnd::TAB_ITEM_INFO * pTii


) const


{


return NULL;


}


void CIOSTabCtrl::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


)


{


CRect my_rect = rcEntireItem;


if(nItemIndex == 0)


my_rect.InflateRect(0,0,50,0);


else


my_rect.InflateRect(-(50*nItemIndex),0,((50*nItemIndex)+50),0);


CExtTabWnd::OnTabWndDrawItem( dc,


rcTabItemsArea,


nItemIndex,


pTii,


bTopLeft,


bHorz,


bSelected,


bCenteredText,


bGroupedMode,


bInGroupActive,


bInvertedVerticalMode,


my_rect,


sizeTextMeasured,


pFont,


sText,


pIcon);


return;


}


 


 


void CIOSTabCtrl::OnTabWndItemInsert(


LONG nItemIndex,


TAB_ITEM_INFO * pTii


)


{


CRect my_rect = pTii->ItemRectGet();


if(nItemIndex == 0)


my_rect.InflateRect(0,0,50,0);


else


my_rect.InflateRect(-(50*nItemIndex),0,((50*nItemIndex)+50),0);


pTii->ItemRectSet(my_rect);


}

Technical Support Dec 16, 2005 - 8:54 AM

If you want to change the size of tab items, then just override the CExtTabWnd::OnTabWndUpdateItemMeasure() virtual method like as follows:

void CIOSTabCtrl::OnTabWndUpdateItemMeasure(
    CExtTabWnd::TAB_ITEM_INFO * pTii,
    CDC & dcMeasure,
    CSize & sizePreCalc
    )
{
    CExtTabWnd::OnTabWndUpdateItemMeasure(
        pTii,
        dcMeasure,
        sizePreCalc
        );
    // NOTE: sizePreCalc is size of tab item computed by default
    // TO DO: change sizePreCalc to make tab item larger
}