Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Toolbars in dialogs

Toolbars in dialogs

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialjavascriptquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HvalaMne
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • H HvalaMne

      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

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      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();

      H 1 Reply Last reply
      0
      • R Rage

        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();

        H Offline
        H Offline
        HvalaMne
        wrote on last edited by
        #3

        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

        R 1 Reply Last reply
        0
        • H HvalaMne

          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

          R Offline
          R Offline
          Rage
          wrote on last edited by
          #4

          Your code works for me. ~RaGE();

          H 1 Reply Last reply
          0
          • R Rage

            Your code works for me. ~RaGE();

            H Offline
            H Offline
            HvalaMne
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups