Dialog Bar
-
how can i create a dialog bar in my application.. I inserted the resource Insert->dialog-dialogbar.. When i try to create a class for my dialogbar, using class wizard.. the Base class CDialogBar is not displayed . . . what can i do . .
Proud To Be an Indian
-
how can i create a dialog bar in my application.. I inserted the resource Insert->dialog-dialogbar.. When i try to create a class for my dialogbar, using class wizard.. the Base class CDialogBar is not displayed . . . what can i do . .
Proud To Be an Indian
Do you mean toolbar? If it's toolbar, you can do accroding to the following step. 1)create a toolbar resource "Insert->toolbar" 2)add a member CToolBar m_wndToolBar; 3)add the following code in your OnInitDialog() if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } m_wndToolBar.ShowWindow(SW_SHOW); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); I hope it will works.;P
-
how can i create a dialog bar in my application.. I inserted the resource Insert->dialog-dialogbar.. When i try to create a class for my dialogbar, using class wizard.. the Base class CDialogBar is not displayed . . . what can i do . .
Proud To Be an Indian
Hi, I usually derive it from CDialog and rename the CDialog to CDialogBar and if you need you can simplify the create() function with
BOOL CYourDlgBar::Create(CWnd* pParentWnd, UINT nStyle) { return CDialogBar::Create(pParentWnd, IDD, nStyle, IDD); }
And on your frame window create, dock your dialog barm_yourDlgBarObj.Create(this, //frame instance WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD |WS_VISIBLE | //style CBRS_BOTTOM|CBRS_TOOLTIPS); m_yourDlgBarObj.EnableDocking(CBRS_ALIGN_BOTTOM | CBRS_ALIGN_TOP); DockControlBar(&m_yourDlgBarObj);
-
Do you mean toolbar? If it's toolbar, you can do accroding to the following step. 1)create a toolbar resource "Insert->toolbar" 2)add a member CToolBar m_wndToolBar; 3)add the following code in your OnInitDialog() if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } m_wndToolBar.ShowWindow(SW_SHOW); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); I hope it will works.;P
-
Hi, I usually derive it from CDialog and rename the CDialog to CDialogBar and if you need you can simplify the create() function with
BOOL CYourDlgBar::Create(CWnd* pParentWnd, UINT nStyle) { return CDialogBar::Create(pParentWnd, IDD, nStyle, IDD); }
And on your frame window create, dock your dialog barm_yourDlgBarObj.Create(this, //frame instance WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD |WS_VISIBLE | //style CBRS_BOTTOM|CBRS_TOOLTIPS); m_yourDlgBarObj.EnableDocking(CBRS_ALIGN_BOTTOM | CBRS_ALIGN_TOP); DockControlBar(&m_yourDlgBarObj);
-
OK its working now ... i followed what u said . . . I had a button in the dialog bar . . but its disabled why . . .
Proud To Be an Indian
It is the property of MFC, MFC disables controls if the handlers is not available override OnUpdateCmdUI() this will enable all. But MFC wants handlers for each control Best Regards Raj
-
It is the property of MFC, MFC disables controls if the handlers is not available override OnUpdateCmdUI() this will enable all. But MFC wants handlers for each control Best Regards Raj
-
Sorry Raj ... can u plz be more specific... How to add OnUpdateCmdUI() There was a button & text box. The text box is enabled... I added some functionality to the buttn just to display hello,..
Proud To Be an Indian
Now you have your CYourDlgBarClass, using class wizard add the override OnUpdateCmdUI(), that's all, this will add
virtual void OnUpdateCmdUI( IN CFrameWnd* pTarget, IN BOOL bDisableIfNoHandler );
in your declaration andvoid CYourDlgBarClass::OnUpdateCmdUI( IN CFrameWnd* /*pTarget*/, IN BOOL /*bDisableIfNoHandler*/ ) { // TODO: Add your specialized code here and/or call the base class }
in your implementation if class wizard found to be not helpful, simply code manually, this is enough to enable. for enabling individual controls , useON_UPDATE_COMMAND_UI(id /* control id*/, memberFxn )
in the message map. Best Regards -
Now you have your CYourDlgBarClass, using class wizard add the override OnUpdateCmdUI(), that's all, this will add
virtual void OnUpdateCmdUI( IN CFrameWnd* pTarget, IN BOOL bDisableIfNoHandler );
in your declaration andvoid CYourDlgBarClass::OnUpdateCmdUI( IN CFrameWnd* /*pTarget*/, IN BOOL /*bDisableIfNoHandler*/ ) { // TODO: Add your specialized code here and/or call the base class }
in your implementation if class wizard found to be not helpful, simply code manually, this is enough to enable. for enabling individual controls , useON_UPDATE_COMMAND_UI(id /* control id*/, memberFxn )
in the message map. Best RegardsThanks its working nicely . . . can u plz explain what is happening behind.. 1) the UpdateCmdUI was not in Class wizard 2)no code was given inside CYourDlgBarClass::OnUpdateCmdUI(IN CFrameWnd,IN BOOL) { } then how it is enabled??? 3)What is the IN type oops a small probs its not coming in order.. i added it after the main tool bar buts its comming before the standard tool bar..
Proud To Be an Indian
-
Thanks its working nicely . . . can u plz explain what is happening behind.. 1) the UpdateCmdUI was not in Class wizard 2)no code was given inside CYourDlgBarClass::OnUpdateCmdUI(IN CFrameWnd,IN BOOL) { } then how it is enabled??? 3)What is the IN type oops a small probs its not coming in order.. i added it after the main tool bar buts its comming before the standard tool bar..
Proud To Be an Indian
- No it can be found in class wizard, I donot have issue in VS2005, 2) The default implementation will disable it, we overrided it. 3) IN is simply a empty macro, used just for code readability, (the parameter is input that is caller donot expect change, there is also OUT macro). You need to use DockControlBar() with all parameters set to customise the order of docking. Best Regards Raj