Hi ,
To dynamically set the tab in LTabscontrol (from one of the
old thread) . I have xml file in which all the tab is define i read the
file and load the tabs , But the problem is
all tabs get mixed with all other existing or new view.
Firstly, I try to delete all the existing tab in
Ltabcontrol , Secondly according to preferences set by user try to load
tab at runtime. But suppose i load six tabs at a time then all that
six tabs get merge/overlaped with other, when i switch one tab to other
.. I did call the
TabsControl->Refresh(); function also.
Whats wrong in this code please suggest.
void AddNormalTabs()
{
UInt16 i, count;
Str255 l_pTName;
LTabsControl *l_pTabs = dynamic_cast<LTabsControl *>(GetLWindow()->
FindPaneByID(VAR_TABCONTROL));
LMultiPanelView *l_pMulti = dynamic_cast<LMultiPanelView
*>(GetLWindow()-> FindPaneByID(SR_MPV));
if(l_pMulti->GetPanelCount() > 0) //Clear all tabs
{
l_pTabs->SetMaxValue(0);
for( i=l_pMulti->GetPanelCount() ; i > 0 ; i-- )
l_pMulti->RemovePanel(i);
l_pTabs->Refresh();
}
count = 0;
for( i = 0; i <
CWorker::GetWorker()->GetConfiguration()->GetUserInterfaceTabCount();
i++)
//Refill the tabs
{
UserInterfaceTab UItab;
GetUserInterfaceTab(i, &UItab);
if(! UItab.hidden)
{
if(strcmp(UItab.Name.c_str(), TAB_CUSTOM) == 0) //TODO
{
count++;
l_pTabs->SetMaxValue(count);
LView *l_pView =
UReanimator::CreateView(GetTabPPobID(&UItab.Name), l_pMulti,
l_pMulti);
l_pMulti->AddPanel(-1, l_pView, count);
c2pstrcpy(l_pTName, UItab.Name.c_str());
ControlRef l_pCRef =
l_pTabs->GetControlImp()->GetMacControl();
ControlTabInfoRec l_CInfo;
l_CInfo.version = kControlTabInfoVersionZero;
l_CInfo.iconSuiteID = 0;
LString::CopyPStr( l_pTName, l_CInfo.name, sizeof(l_pTName));
OSStatus l_Val = SetControlData(l_pCRef, count,
kControlTabInfoTag, sizeof(l_CInfo), &l_CInfo);
l_pTabs->Refresh();
ThrowIfOSStatus_(l_Val);
}
}
}
Thanks in advance,


|