PropertyPage and DialogBar Updated question
OK i have, thusfar, figured out that i have to embed a PropertySheet onto my DialogBar. sounds pretty straightforward but when I try to do an OnCreate for the DialogBar then do a
GetTabCtrl() for the Property Sheet i get an assert. The TabCtrl comes out NULL.
I assume something isn't being initialized. apparently the CDialogBar does not have an OnInitDialog() because it is created with the mainframe window
Any help on this will be most appreciated!
[479 byte] By [
jjasperXX] at [2007-11-18 17:41:26]

# 1 Re: PropertyPage and DialogBar Updated question
Write your own InitDialog function and call it after you create
the dialogbar
if(!MyDialogBar_.Create(....)
{
Handle error
}
if(!MyDialogBar_.InitDialog())
{
Handle Error
}
Have your InitDialog return a bool just in case something fails
# 4 Re: PropertyPage and DialogBar Updated question
ok here is my init function for the DialogBar
void PropertiesDlg::InitPropertyPage()
{
CRect rcNewPosition;
CWnd * pWndNewArea = GetDlgItem(IDC_PSHEET_AREA); // IDC_PSHEET_AREA is a picture control used as a source for the rectangle
GetWindowRect(&rcNewPosition);
ScreenToClient(&rcNewPosition);
CTabCtrl* pTabCtrl = m_property_sht->GetTabControl();
ASSERT(pTabCtrl != NULL);
CRect rcTabCtrl;
pTabCtrl->GetWindowRect(&rcTabCtrl);
ScreenToClient(&rcTabCtrl);
CRect rcPSheet;
m_property_sht->GetWindowRect(&rcPSheet);
ScreenToClient(&rcPSheet);
int dcx = rcPSheet.Width()-rcTabCtrl.Width();
int dcy = rcPSheet.Height()-rcTabCtrl.Height();
m_property_sht->MoveWindow(rcNewPosition.left, rcNewPosition.top, rcNewPosition.Width(),
rcNewPosition.Height());
pTabCtrl->SetWindowPos(NULL, 0, 0, rcNewPosition.Width(),
rcNewPosition.Height(), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
int cp=m_property_sht->GetActiveIndex();
for(int i=0;i<m_property_sht->GetPageCount();i++)
m_property_sht->SetActivePage(i);
m_property_sht->SetActivePage(cp);
}
and i do this on the CDialog::OnCreate
m_property_sht = new SAIPropertSht((LPCTSTR)"Properties", this);
m_property_sht->ModifyStyle(0, WS_TABSTOP);
m_property_sht->ModifyStyleEx(0 WS_EX_CONTROLPARENT);
ModifyStyleEx(0, WS_EX_CONTROLPARENT);