dialog button disabled !!!!
-
Hi, I have an MDI MFC VS2005 app. I added a dialog bar in resource view and changed the basze class from CDialog to CDialogBar. I use following code to create the dialogbar. Now it is created fine and it aligns at bottom as intended, but all the buttons on the dialogbar are disabled!!!. What's going on here? int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; EnableDocking(CBRS_ALIGN_ANY); m_launchbar.Create( this, IDD_LAUNCHBAR, CBRS_BOTTOM , IDD_LAUNCHBAR ); } In addition to the above problem the OnShowWindow is fired only when exiting the app and never when the app is started. IMPLEMENT_DYNAMIC(CLaunchbar, CDialogBar) CLaunchbar::CLaunchbar(CWnd* pParent /*=NULL*/) : CDialogBar() { } CLaunchbar::~CLaunchbar() { } void CLaunchbar::DoDataExchange(CDataExchange* pDX) { CDialogBar::DoDataExchange(pDX); DDX_Control(pDX, IDC_LBREXITAPP, m_lbrExitApp); } BEGIN_MESSAGE_MAP(CLaunchbar, CDialogBar) ON_WM_SHOWWINDOW( ) ON_BN_CLICKED(IDC_LBREXITAPP, &CLaunchbar::OnBnClickedLbrexitapp) END_MESSAGE_MAP() // CLaunchbar message handlers void CLaunchbar::OnShowWindow( BOOL bShow, UINT nStatus ) { } void CLaunchbar::OnBnClickedLbrexitapp() { // TODO: Add your control notification handler code here } Any help please?
-
Hi, I have an MDI MFC VS2005 app. I added a dialog bar in resource view and changed the basze class from CDialog to CDialogBar. I use following code to create the dialogbar. Now it is created fine and it aligns at bottom as intended, but all the buttons on the dialogbar are disabled!!!. What's going on here? int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; EnableDocking(CBRS_ALIGN_ANY); m_launchbar.Create( this, IDD_LAUNCHBAR, CBRS_BOTTOM , IDD_LAUNCHBAR ); } In addition to the above problem the OnShowWindow is fired only when exiting the app and never when the app is started. IMPLEMENT_DYNAMIC(CLaunchbar, CDialogBar) CLaunchbar::CLaunchbar(CWnd* pParent /*=NULL*/) : CDialogBar() { } CLaunchbar::~CLaunchbar() { } void CLaunchbar::DoDataExchange(CDataExchange* pDX) { CDialogBar::DoDataExchange(pDX); DDX_Control(pDX, IDC_LBREXITAPP, m_lbrExitApp); } BEGIN_MESSAGE_MAP(CLaunchbar, CDialogBar) ON_WM_SHOWWINDOW( ) ON_BN_CLICKED(IDC_LBREXITAPP, &CLaunchbar::OnBnClickedLbrexitapp) END_MESSAGE_MAP() // CLaunchbar message handlers void CLaunchbar::OnShowWindow( BOOL bShow, UINT nStatus ) { } void CLaunchbar::OnBnClickedLbrexitapp() { // TODO: Add your control notification handler code here } Any help please?
venadder wrote:
Now it is created fine and it aligns at bottom as intended, but all the buttons on the dialogbar are disabled!!!. What's going on here?
Write event handlers for the buttons.
Nibu thomas Software Developer
-
venadder wrote:
Now it is created fine and it aligns at bottom as intended, but all the buttons on the dialogbar are disabled!!!. What's going on here?
Write event handlers for the buttons.
Nibu thomas Software Developer
-
already have event handlers for on click as folows: public: afx_msg void OnBnClickedLbrexitapp(); void CLaunchbar::OnBnClickedLbrexitapp() { // TODO: Add your control notification handler code here }
you created button and declare function for buttons but buttons are disable,right?
-
already have event handlers for on click as folows: public: afx_msg void OnBnClickedLbrexitapp(); void CLaunchbar::OnBnClickedLbrexitapp() { // TODO: Add your control notification handler code here }
venadder wrote:
void CLaunchbar::OnBnClickedLbrexitapp()
You must provide a message handler in the MainFrame class not in the DialogBar class.
Nibu thomas Software Developer
-
venadder wrote:
void CLaunchbar::OnBnClickedLbrexitapp()
You must provide a message handler in the MainFrame class not in the DialogBar class.
Nibu thomas Software Developer
-
Thanx for your input. I changed it from dialog bar to CDialog anywyas. I have much more control and flexibility that way. It's easy to position teh window even with CDialog. But thanx for your help. I appreciate it.
venadder wrote:
I changed it from dialog bar to CDialog anywyas. I have much more control and flexibility that way. It's easy to position teh window even with CDialog.
Why oh why!!! Then what is the use of a Dialog bar!!!:sigh: You just have to provide a message handler for the button in the main frame class. That's all. Nothing more nothing less. Just like you would do for a toolbar button.:)
Nibu thomas Software Developer