Hope you are ready for my slew of questions about MFC.
The biggest problem I have is using the friggin class wizard because I can never get it to do what I want.
I have constructed a CDialogBar that uses CBRS_FLOAT_MULTI and CBRS_ALIGN_ANY. The actual dialog control has one button on it labeled btnLoad.
I understand how to construct the CDialogBar but how do I control the dialog itself. The docs say you normally don't have to derive a class from CDialog for a CDialogBar...but they don't explain why by Load button is not showing up in the main frame window class.
According to what they are saying the button in the dialog box template used in CDialogBar should show up in my main frame window class and then I just react to the message from that class. But it doesn't show up.
So do I have to create a class derived from CDialog to control the actual dialog and also create the CDialogBar? I'm sorta lost.
Problem is when I create a function for OnBtnload() for my CDialog...the button is still greyed out. In fact it's like my code isn't even being linked into the project but it does appear in the project. This is proven by the fact that I can delete the code and the program still runs. So its not even using the code for the dialog. How do I get the class wizard to associate my dialog code with the actual CDialogBar??Code:int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this) || !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() & ~CBRS_HIDE_INPLACE); if (!m_wndDlgBar.Create(this, IDR_MAINFRAME, CBRS_ALIGN_LEFT | CBRS_GRIPPER, AFX_IDW_DIALOGBAR)) { TRACE0("Failed to create dialog bar\n"); return -1; // fail to create } m_wndDlgBar.EnableDocking(CBRS_FLOAT_MULTI | CBRS_ALIGN_ANY); if (!m_wndReBar.Create(this) || !m_wndReBar.AddBar(&m_wndToolBar)) { TRACE0("Failed to create rebar\n"); return -1; // fail to create } m_wndReBar.SetBarStyle(m_wndReBar.GetBarStyle() & ~CBRS_HIDE_INPLACE); if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Remove this if you don't want tool tips m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY) ; return 0; } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return TRUE; }
Geez..........Direct3D is a helluva lot easier than this.