views:

198

answers:

1

After changing the text in a tab control's tab header, how do I tell it to recalculate the layout of the children (e.g., if the new tabs take up two rows)?

I am changing the tab text like this, from within a property page:

TC_ITEM ti;
ti.mask = TCIF_TEXT;
ti.pszText = _T("whatever....");
CTabCtrl *pTabs = ((CPropertySheetEx *)GetParent())->GetTabControl();
pTabs->SetItem(m_nIdx, &ti);
+1  A: 

I looked in the MFC source code (dlgprop.cpp, in VC++ 6.0) and specifically the:

BOOL CPropertySheet::OnInitDialog()


It seems that the calculations that you need are done there.

Just try to call the OnInitDialog(). It does only property sheet window resizes.
Of course, you can check the source code for more hints.

Nick D
This would have worked, but I chose to just EnableStackedTabs(FALSE) rather than introduce this complexity into my program.
Nick
Oh, I thought you wanted stacked rows but you had a problem with their appearance :)
Nick D
Of course, you could have post your solution as an answer. Anyway, cheers.
Nick D