SetWindowPos in tabbed control
Hi all,
I am trying to include a tab control in my dialog based application. Here is
what i am doing
BOOL Cgui::OnInitDialog()
{
dlg1.Create (Cdialog1::IDD,this);//dlg1 is the object of the dialog box
which i
need as first tab
dlg2.Create (Cdialog2::IDD,this););//dlg2 is the object of the dialog
box which i
need as second tab
m_wndtab.InsertItem(TCIF_TEXT, 0,"Results", 0,0,0,0);
m_wndtab.InsertItem(TCIF_TEXT, 1,"My Task", 0,0,0,0);
Update();
}
void Cgui::Update()
{
RECT rc;
m_wndtab.GetItemRect (0, &rc);
int current = m_TAB.GetCurSel();
if(current == 0)
{
dlg1.SetWindowPos (NULL, rc.left + 5, rc.bottom + 5, 0, 0,
SWP_NOSIZE|SWP_NOZORDER | SWP_SHOWWINDOW);
dlg1.ShowWindow(SW_SHOW);
dlg1.SetFocus();
}
//similarly do it for current ==1
}
//the code is not complete with lot of things not shown here
Also OnTcnSelchangeTab1 handler calls Update. So basically what i am trying
to do in update is to get tab area, then get the current selected tab and
based on that set the position of window of dlg1 so that it fits the tab
control area. But i am not sure why is it not working.
Basically i want the dialog boxes dlg1 and dlg2 fit the tab control area.
But i am not sure how do i go about it??
Thanks
kunal