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. Toolbar with button controls

Toolbar with button controls

Scheduled Pinned Locked Moved C / C++ / MFC
comdesigndata-structuresquestion
5 Posts 3 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.
  • N Offline
    N Offline
    Nathan Going
    wrote on last edited by
    #1

    I want to make a toolbar type window that has owner drawn button controls on it. I also need to be able to "stack" them on one side, either left or right, but those are two different issues. Figure 1 is the application I’m trying to mimic and I know it was written in Qt. notice the controls across the top of the main window and to bars across each view on either side of the splitter. I believe it should be possible to design a bar that I could use in all three places with little modification. Figure 2 is what I can figure to be the window structure I should use. Please how would you implement the toolbar I described? Thank you, Nathan

    M V 2 Replies Last reply
    0
    • N Nathan Going

      I want to make a toolbar type window that has owner drawn button controls on it. I also need to be able to "stack" them on one side, either left or right, but those are two different issues. Figure 1 is the application I’m trying to mimic and I know it was written in Qt. notice the controls across the top of the main window and to bars across each view on either side of the splitter. I believe it should be possible to design a bar that I could use in all three places with little modification. Figure 2 is what I can figure to be the window structure I should use. Please how would you implement the toolbar I described? Thank you, Nathan

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Are you using MFC? If so, I personally use a CControlBar-derived class. Overriding CalcFixedLayout/CalcDynamicLayout makes it easy to position any controls (and/or individual CToolBars) and report the total size of the bar to MFC. There's also the CDialogBar if you prefer to work with a dialog resource as a control bar. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      N 1 Reply Last reply
      0
      • N Nathan Going

        I want to make a toolbar type window that has owner drawn button controls on it. I also need to be able to "stack" them on one side, either left or right, but those are two different issues. Figure 1 is the application I’m trying to mimic and I know it was written in Qt. notice the controls across the top of the main window and to bars across each view on either side of the splitter. I believe it should be possible to design a bar that I could use in all three places with little modification. Figure 2 is what I can figure to be the window structure I should use. Please how would you implement the toolbar I described? Thank you, Nathan

        V Offline
        V Offline
        vikas amin
        wrote on last edited by
        #3

        check this articles http://www.codeproject.com/KB/wtl/wtl4mfc3.aspx[^] http://www.codeproject.com/KB/toolbars/ctruecolortoolbar_update.aspx[^] there is a toolbar class for .net 3.0 & 3.5 but i dont think you want to use them

        Vikas Amin

        My First Article on CP" Virtual Serial Port "[^]

        modified on Thursday, July 24, 2008 5:33 PM

        1 Reply Last reply
        0
        • M Mark Salsbery

          Are you using MFC? If so, I personally use a CControlBar-derived class. Overriding CalcFixedLayout/CalcDynamicLayout makes it easy to position any controls (and/or individual CToolBars) and report the total size of the bar to MFC. There's also the CDialogBar if you prefer to work with a dialog resource as a control bar. Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          N Offline
          N Offline
          Nathan Going
          wrote on last edited by
          #4

          What would be the best way to make that CControlBar-Derived class the full width of it's parent.

          M 1 Reply Last reply
          0
          • N Nathan Going

            What would be the best way to make that CControlBar-Derived class the full width of it's parent.

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Nathan Going wrote:

            What would be the best way to make that CControlBar-Derived class the full width of it's parent.

            I don't know the best way, but I use something like this:

            CSize CMyControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
            {
            // Get the parent's client window size
            // in case we need that info to layout
            // controls
            CRect ParentClientRect;
            GetParent()->GetClientRect(&ParentClientRect);

            //
            // calc the layout of all the controls here
            // ...

            int desiredheight = ...;

            return CSize(ParentClientRect.Width(), desiredheight);
            }

            CSize CMyControlBar::CalcDynamicLayout(int nLength, DWORD dwMode)
            {
            return CalcFixedLayout(dwMode & LM_STRETCH, dwMode & LM_HORZ);
            }

            Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            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