Let's assume you're trying to create the object using DDX. In other words, you've embedded an object of the correct type in your class definition and written a DoDataExchange function with the appropriate DDX_Control() call. It might look like this (simplified). Header file.
class CMyDialogBar : public CDialogBar
{
public:
CMyTabbedControl m_tabControl;
virtual void DoDataExchange(CDataExchange\* pDX);
virtual void OnInitDialog();
};
and your implementation file looks like this.
void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
{
CDialogBar::DoDataExchange(pDX);
DDX_Control(pDX, IDC_MYTABCONTROL, m_tabControl);
}
void CMyDialogBar::OnInitDialog()
{
CDialogBar::OnInitDialog();
return TRUE;
}
And yet it doesn't work. As you've noticed, OnInitDialog() isn't called for a DialogBar. The solution I found was to add a function Initialise() to the DialogBar derived class and call it once I knew the dialog bar had been created.
void CMyDialogBar::Initialise()
{
UpdateData(FALSE);
}
Yes, it's that simple. Just call UpdateData() (make sure the call occurs before any code that tries to use the TabControl) and the control will be created. Rob Manderson Colin Davies wrote: I'm sure Americans could use more of it, and thus reduce the world supply faster. This of course would be good, because the faster we run out globally, the less chance of pollution there will be. (Talking about the price of petrol) The Soapbox, March 5 2004