Click to See Complete Forum and Search --> : The step of creating a DialogBar


xyjiang
May 6th, 1999, 09:12 PM
What's the step of creating a CDialogBar object? Should I assign a new class to it?

I create a dialog bar and place a button control on it. After this, I write the code of the click event. But the button doesn't enable when I execute the program. What's wrong with it?

shridhar rao
May 6th, 1999, 11:40 PM
Hi,
All you have to do is add the dialogbar component to your project from the Project-->Add to Project-->Components and controls. This is the fastest way to show a dialog bar without coding at all. Once you have added it you can check out your mainfrm.cpp for the implementation details.

About the button not getting enabled. As far as my knowledge goes, controls in the dialog bar send a WM_COMMAND to the mainframe. You'll have to add the message handler yourselves.
In the mainfrm.cpp add the ON_COMMAND Macro
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_COMMAND_EX(CG_ID_VIEW_MYDIALOGBAR, OnBarCheck)
ON_UPDATE_COMMAND_UI(CG_ID_VIEW_MYDIALOGBAR, OnUpdateControlBarMenu)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in //these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_COMMAND(IDC_BUTTON_TEST,OnTest)//macro //added
END_MESSAGE_MAP()

Later declare the OnTest in the .h file
afx_msg void OnTest();
in the .cpp implement it
void CMainFrame::OnTest()
{
AfxMessageBox("test");

}
I hope this helps

xyjiang
May 7th, 1999, 04:17 AM
Thanks for your reply.
But do you know how about to add a OCX in a dialog bar?