Toolbars in dialogs
-
I want to make toolbar in dialog, like those which is in IE, WinZip, WinRar etc. How to do it, any example? Toolbars are easily built in CFrame, but not in CDlg. Now I made it through CStatic bitmaps, but those bitmaps do not react VISUALLY on mouse events, clicking, getting focus etc. -- modified at 5:03 Thursday 13th April, 2006
-
I want to make toolbar in dialog, like those which is in IE, WinZip, WinRar etc. How to do it, any example? Toolbars are easily built in CFrame, but not in CDlg. Now I made it through CStatic bitmaps, but those bitmaps do not react VISUALLY on mouse events, clicking, getting focus etc. -- modified at 5:03 Thursday 13th April, 2006
-
HvalaMne wrote:
Now I made it through CStatic bitmaps
:~ You can embed a CToolbar normally in a dialog. Here a good start: http://www.codeproject.com/docking/arbitrarytoolbar.asp[^] ~RaGE();
Rage wrote:
You can embed a CToolbar normally in a dialog.
But I can't. :( I made toolbar itself and toolbar variable
public:
CMainDlg(CWnd* pParent = NULL); // standard constructor
CMenu shlMenu;
CToolBar shlToolBar;I inserted in OnInitDialog next lines
shlToolBar.Create(this);
int m = shlToolBar.LoadToolBar(IDR_TOOLBAR); // returns 1
shlToolBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
shlToolBar.ShowWindow(SW_SHOW);but I don't see any toolbar. May be I something forgot? Or I need static control to place toolbar in and no way without it? PS I tried to do exactly in reference, but all I got it's frame about toolbox. No any buttons. http://x-14224.narod.ru/screen.jpg -- modified at 9:19 Thursday 13th April, 2006
-
Rage wrote:
You can embed a CToolbar normally in a dialog.
But I can't. :( I made toolbar itself and toolbar variable
public:
CMainDlg(CWnd* pParent = NULL); // standard constructor
CMenu shlMenu;
CToolBar shlToolBar;I inserted in OnInitDialog next lines
shlToolBar.Create(this);
int m = shlToolBar.LoadToolBar(IDR_TOOLBAR); // returns 1
shlToolBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
shlToolBar.ShowWindow(SW_SHOW);but I don't see any toolbar. May be I something forgot? Or I need static control to place toolbar in and no way without it? PS I tried to do exactly in reference, but all I got it's frame about toolbox. No any buttons. http://x-14224.narod.ru/screen.jpg -- modified at 9:19 Thursday 13th April, 2006
-
All functions return TRUE but Dlg is not seen. :( May be matter is my dialog is modeless? If I surely not forgot anything? I just added toolbar itself, toolbar member (public)
class CMainDlg : public CDialog
{
DECLARE_DYNAMIC(CMainDlg)
public:
CToolBar tb;
...
}and that lines in OnInitDialog:
BOOL CMainDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(tb.Create(this))
{
if( tb.LoadToolBar(IDR_TOOLBAR1) ){
tb.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
tb.ShowWindow(SW_SHOW); // <--- here goes
}
}I made no handlers but tb must already be seen at this stage IMHO? PS Your code works for me. I begun aproach your code to mine and revealed next thing. After commenting line m_wndFormatBar.SetWindowPlacement(&wpl); in your code your toolbar disappearing too. So write just
m_wndFormatBar.Create(this); // attach command routing to dialog window
m_wndFormatBar.LoadToolBar(IDR_TOOLBAR_FORMAT);
m_wndFormatBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndFormatBar.ShowWindow(SW_SHOW);is not enough to show toolbar. At least at mine comp. I will investigate it on. And thanks for example. -- modified at 6:00 Friday 14th April, 2006