CDialogBar does not support controls
-
HI all; I am building an application which should have a tab control on a CDialogBar. Visual C++ gladly added the dockable dialog bar for me but i could not figure out where to put the code to create the tab control since the OnInitDialog() function is simply ineffective. Can anybody please help out. I need to know where i should place my code to create the TAb control on the dialogbar. I badly need this guys; THanks Krugger
-
HI all; I am building an application which should have a tab control on a CDialogBar. Visual C++ gladly added the dockable dialog bar for me but i could not figure out where to put the code to create the tab control since the OnInitDialog() function is simply ineffective. Can anybody please help out. I need to know where i should place my code to create the TAb control on the dialogbar. I badly need this guys; THanks Krugger
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 appropriateDDX_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 functionInitialise()
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