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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Auto align of toolbar by frame width

Auto align of toolbar by frame width

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 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.
  • A Offline
    A Offline
    akhil_sudheesh
    wrote on last edited by
    #1

    Hi, am building a GUI MFC application, I have several toolbars in my application, i want my toolbars to auto align according to my application frame width, the code i have been tried is given below. By this code the toolbar is simply align in a single row. what should i do to reach my goal?:confused: thanks in advance

    m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
    tb1.EnableDocking(CBRS_ALIGN_ANY);
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    tb4.EnableDocking(CBRS_ALIGN_ANY);
    tb8.EnableDocking(CBRS_ALIGN_ANY);
    tb9.EnableDocking(CBRS_ALIGN_ANY);
    tb2.EnableDocking(CBRS_ALIGN_ANY);
    tb3.EnableDocking(CBRS_ALIGN_ANY);
    tb6.EnableDocking(CBRS_ALIGN_ANY);
    tb7.EnableDocki:confused:ng(CBRS_ALIGN_ANY);

    EnableDocking(CBRS\_ALIGN\_ANY);
    
    DockPane(&m\_wndMenuBar);
    DockPane(&tb9);
    DockPaneLeftOf(&tb8, &tb9);
    DockPaneLeftOf(&tb4, &tb8);
    DockPaneLeftOf(&m\_wndToolBar, &tb4);
    DockPaneLeftOf(&tb1, &m\_wndToolBar);
    DockPaneLeftOf(&tb7, &tb1);
    DockPaneLeftOf(&tb6, &tb7);
    DockPaneLeftOf(&tb3, &tb6);
    DockPaneLeftOf(&tb2, &tb3);
    

    A learner

    R 1 Reply Last reply
    0
    • A akhil_sudheesh

      Hi, am building a GUI MFC application, I have several toolbars in my application, i want my toolbars to auto align according to my application frame width, the code i have been tried is given below. By this code the toolbar is simply align in a single row. what should i do to reach my goal?:confused: thanks in advance

      m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
      tb1.EnableDocking(CBRS_ALIGN_ANY);
      m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
      tb4.EnableDocking(CBRS_ALIGN_ANY);
      tb8.EnableDocking(CBRS_ALIGN_ANY);
      tb9.EnableDocking(CBRS_ALIGN_ANY);
      tb2.EnableDocking(CBRS_ALIGN_ANY);
      tb3.EnableDocking(CBRS_ALIGN_ANY);
      tb6.EnableDocking(CBRS_ALIGN_ANY);
      tb7.EnableDocki:confused:ng(CBRS_ALIGN_ANY);

      EnableDocking(CBRS\_ALIGN\_ANY);
      
      DockPane(&m\_wndMenuBar);
      DockPane(&tb9);
      DockPaneLeftOf(&tb8, &tb9);
      DockPaneLeftOf(&tb4, &tb8);
      DockPaneLeftOf(&m\_wndToolBar, &tb4);
      DockPaneLeftOf(&tb1, &m\_wndToolBar);
      DockPaneLeftOf(&tb7, &tb1);
      DockPaneLeftOf(&tb6, &tb7);
      DockPaneLeftOf(&tb3, &tb6);
      DockPaneLeftOf(&tb2, &tb3);
      

      A learner

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

      Your intention is not totally clear, can you try and explain better what you are trying to do and what is not working ?

      ~RaGE();

      I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what is used to.

      A 1 Reply Last reply
      0
      • R Rage

        Your intention is not totally clear, can you try and explain better what you are trying to do and what is not working ?

        ~RaGE();

        I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what is used to.

        A Offline
        A Offline
        akhil_sudheesh
        wrote on last edited by
        #3

        Hi, thanks for the replay, my program consist of 9 toolbars of which different length, when i arrange my toolbars it appearing on a single row, so some of my toolbars are not visible am sharing a screen shot with this replay the first image shows how toolbar appears when i build the application, the 2nd image shows my requirement https://plus.google.com/photos/108871638000088451495/albums/5990517728523218353?authkey=COPXvr6RjcCABQ[^] hope you understand my requirement thank you

        A learner

        R 2 Replies Last reply
        0
        • A akhil_sudheesh

          Hi, thanks for the replay, my program consist of 9 toolbars of which different length, when i arrange my toolbars it appearing on a single row, so some of my toolbars are not visible am sharing a screen shot with this replay the first image shows how toolbar appears when i build the application, the 2nd image shows my requirement https://plus.google.com/photos/108871638000088451495/albums/5990517728523218353?authkey=COPXvr6RjcCABQ[^] hope you understand my requirement thank you

          A learner

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

          OK, I see. Can you fish something out of this code sample : http://msdn.microsoft.com/en-us/library/bb983325%28v=vs.90%29.aspx[^]

          ~RaGE();

          I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

          1 Reply Last reply
          0
          • A akhil_sudheesh

            Hi, thanks for the replay, my program consist of 9 toolbars of which different length, when i arrange my toolbars it appearing on a single row, so some of my toolbars are not visible am sharing a screen shot with this replay the first image shows how toolbar appears when i build the application, the 2nd image shows my requirement https://plus.google.com/photos/108871638000088451495/albums/5990517728523218353?authkey=COPXvr6RjcCABQ[^] hope you understand my requirement thank you

            A learner

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

            Another comment: Is your toolbar CMFCToolbar ? From MSDN: http://msdn.microsoft.com/en-us/library/cc665920.aspx[^]

            This method (EnableDocking) extends the base class implementation, CBasePane::EnableDocking, by setting the CBasePane::m_dwControlBarStyle data member to AFX_CBRS_FLOAT. This method then passes dwAlignment to the base class implementation.

            Maybe you would need the AFX_CBRS_RESIZE as well, see here in the base class: http://msdn.microsoft.com/en-us/library/cc701911.aspx[^]

            ~RaGE();

            I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

            A 1 Reply Last reply
            0
            • R Rage

              Another comment: Is your toolbar CMFCToolbar ? From MSDN: http://msdn.microsoft.com/en-us/library/cc665920.aspx[^]

              This method (EnableDocking) extends the base class implementation, CBasePane::EnableDocking, by setting the CBasePane::m_dwControlBarStyle data member to AFX_CBRS_FLOAT. This method then passes dwAlignment to the base class implementation.

              Maybe you would need the AFX_CBRS_RESIZE as well, see here in the base class: http://msdn.microsoft.com/en-us/library/cc701911.aspx[^]

              ~RaGE();

              I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

              A Offline
              A Offline
              akhil_sudheesh
              wrote on last edited by
              #6

              Yes am using CMFCToolbar, i have already checked with palette sample and EnableDocking();, they didnt help me :( i will attach the code i have tried for docking the toolbar

              m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
              m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
              tb1.EnableDocking(CBRS_ALIGN_ANY);
              tb2.EnableDocking(CBRS_ALIGN_ANY);
              tb3.EnableDocking(CBRS_ALIGN_ANY);
              tb4.EnableDocking(CBRS_ALIGN_ANY);
              tb6.EnableDocking(CBRS_ALIGN_ANY);
              tb7.EnableDocking(CBRS_ALIGN_ANY);
              tb8.EnableDocking(CBRS_ALIGN_ANY);
              tb9.EnableDocking(CBRS_ALIGN_ANY);
              EnableDocking(CBRS_ALIGN_ANY);

              DockPane(&m\_wndMenuBar);
              

              // tb1.SetControlBarStyle(AFX_CBRS_RESIZE);
              // m_wndToolBar.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb4.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb8.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb9.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb2.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb3.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb6.SetControlBarStyle(AFX_CBRS_RESIZE);
              // tb7.SetControlBarStyle(AFX_CBRS_RESIZE);

              DockPane(&tb1);
              DockPane(&m\_wndToolBar);
              DockPane(&tb4);
              DockPane(&tb8);
              DockPane(&tb9);
              DockPane(&tb7);
              DockPane(&tb3);
              DockPane(&tb6);
              DockPane(&tb2);
              
              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