Hi!

I've created CMyListBox Class (ownerdraw variable) derived from CListBox,
I've wrote my CMyTabCtrlclass which overrides CTabCtrl and now I'm trying to
create dynamically listboxes and put them in each tab so I could switch
between them by hiding/showing current tab. The problem is that when I
create few listboxes, only the first one looks fine - others have incorect
item height (ON_MEASURE_ITEM event isn't called) except the first item. I've
got no idea what's the reason ?!!

here's how I add tabs:

int CMyTabCtrl::AddTab(const char* pszLabel)
{
TCITEM tcItem;
int tabCount, newIndex;
CMultiLineListBox *pMyListBox, *pPrevListBox;
// ading new tab
tabCount = GetItemCount();
newIndex = InsertItem(tabCount, pszLabel);
// allocate memory for new lisbox
pMyListBox = new CMultiLineListBox();
CRect rLbRect(15,15, 340, 400);
pMyListBox->Create(LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | WS_VSCROLL |
LBS_NOTIFY, LbRect, this, newIndex);
//adding items to listbox
for(int i = 0; i < (int)theApp._i_channels[newIndex].ItemsCount();
i++)
{
CString strTitle =
theApp._i_channels[newIndex].Item(i).Title().c_str();
CString strDescription =
theApp._i_channels[newIndex].Item(i).Description().c_str();
CString strLink =
theApp._i_channels[newIndex].Item(i).Link().c_str();
pMyListBox->AddEntry(strDescription, strLink, strTitle);
}
theApp._i_channels.unlock();
tcItem.mask = TCIF_PARAM;
tcItem.lParam = (LPARAM) pMyListBox;
SetItem(newIndex, &tcItem);
//show added tab and hide previous
int curIndex = GetCurSel();
if (curIndex != -1 && curIndex != newIndex && GetItem(curIndex, &tcItem) &&
(pPrevListBox = (CMultiLineListBox *)tcItem.lParam) != NULL)
{
pPrevListBox->ShowWindow(SW_HIDE);
}
pMyListBox->ShowWindow(SW_SHOW);
CTabCtrl::SetCurSel(newIndex);
return newIndex;
}