How to put a CRebar or CRebarCtrl in a dialog based application?
-
How to put a CRebar or CRebarCtrl in a dialog based application? I my current, I am trying to add a CRebarCtrl into a dialog based application(either modal or modeless). I created the CRebar and also added a Toolbar into it. There is no error, but I cannot see the Rebar. Please reply and tell me what I should do to make the rebar show up. Thanks a lot in advance. I have put the following code in OnInitDialog() if (!m_wndReBar.Create(this)) { AfxMessageBox("Failed to create rebar"); return -1; // fail to create } m_bmap.LoadBitmap(IDB_BITMAP1); m_wndToolBar.CreateEx(this, TBSTYLE_TRANSPARENT | TBSTYLE_FLAT); m_wndToolBar.LoadToolBar(IDR_TOOLBAR1); m_wndReBar.AddBar(&m_wndToolBar,"Main", &m_bmap); Thanks a lot. Bin
-
How to put a CRebar or CRebarCtrl in a dialog based application? I my current, I am trying to add a CRebarCtrl into a dialog based application(either modal or modeless). I created the CRebar and also added a Toolbar into it. There is no error, but I cannot see the Rebar. Please reply and tell me what I should do to make the rebar show up. Thanks a lot in advance. I have put the following code in OnInitDialog() if (!m_wndReBar.Create(this)) { AfxMessageBox("Failed to create rebar"); return -1; // fail to create } m_bmap.LoadBitmap(IDB_BITMAP1); m_wndToolBar.CreateEx(this, TBSTYLE_TRANSPARENT | TBSTYLE_FLAT); m_wndToolBar.LoadToolBar(IDR_TOOLBAR1); m_wndReBar.AddBar(&m_wndToolBar,"Main", &m_bmap); Thanks a lot. Bin
Dialog windows do not support toolbars. Plain & simple. In order to achieve the thing you need with a dialog, you would need to derive from CDialog and write the toolbar drawing code yourself. A much better way, however, is available, if you care to use it. A dialog can be also implemented as a form. This means that you create a CFrameWnd object, then load the form into it's view area. This allows you to have dialog controls while retaining all the advantages of having a frame window, such as a toolbar, a menu, status bar etc etc. Of course it doesn't look like an 'authentic' dialog, but in many cases, it works much better than some self-derived dialog. There might be some articles handling this issue here on CodeProject, but if you want to trek the route I've given, I suggest you read my article Using views effectively without the doc/view overhead[^]. It gives you the basics on how to create a frame window that contains a form view. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.
-
Dialog windows do not support toolbars. Plain & simple. In order to achieve the thing you need with a dialog, you would need to derive from CDialog and write the toolbar drawing code yourself. A much better way, however, is available, if you care to use it. A dialog can be also implemented as a form. This means that you create a CFrameWnd object, then load the form into it's view area. This allows you to have dialog controls while retaining all the advantages of having a frame window, such as a toolbar, a menu, status bar etc etc. Of course it doesn't look like an 'authentic' dialog, but in many cases, it works much better than some self-derived dialog. There might be some articles handling this issue here on CodeProject, but if you want to trek the route I've given, I suggest you read my article Using views effectively without the doc/view overhead[^]. It gives you the basics on how to create a frame window that contains a form view. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.
-
How to put a CRebar or CRebarCtrl in a dialog based application? I my current, I am trying to add a CRebarCtrl into a dialog based application(either modal or modeless). I created the CRebar and also added a Toolbar into it. There is no error, but I cannot see the Rebar. Please reply and tell me what I should do to make the rebar show up. Thanks a lot in advance. I have put the following code in OnInitDialog() if (!m_wndReBar.Create(this)) { AfxMessageBox("Failed to create rebar"); return -1; // fail to create } m_bmap.LoadBitmap(IDB_BITMAP1); m_wndToolBar.CreateEx(this, TBSTYLE_TRANSPARENT | TBSTYLE_FLAT); m_wndToolBar.LoadToolBar(IDR_TOOLBAR1); m_wndReBar.AddBar(&m_wndToolBar,"Main", &m_bmap); Thanks a lot. Bin
Maybe refer to the following link :) http://www.codeproject.com/script/comments/forums.asp?msg=141006&forumid=1647&XtraIDs=1647&searchkw=CReBarCtrl&sd=2%2F16%2F1999&ed=5%2F16%2F2004#xx141008xx[^] How do I print my voice mail?