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. Non-uniform width button in toolbar

Non-uniform width button in toolbar

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 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.
  • G Offline
    G Offline
    gokings
    wrote on last edited by
    #1

    Does anyone know how to have a button on a toolbar which is of a different width than the other buttons? I have tried using multiple toolbars, and that works, but does not give the result I want when the window is made resized small and then back large again. Thanks

    J 1 Reply Last reply
    0
    • G gokings

      Does anyone know how to have a button on a toolbar which is of a different width than the other buttons? I have tried using multiple toolbars, and that works, but does not give the result I want when the window is made resized small and then back large again. Thanks

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      You will need to derive your own class from CToolBar and override some of the functionality. Here are the notes from my code to fix the drop down arrow problem:

      // From: MFC Knowlege base
      // BUG: Resizing CToolbar with Dropdown Arrow Buttons Freezes Apps
      // ID: Q190501

      // From: Microsoft Systems Journal (Aug98CQA.zip)
      // Problem: When using TBSTYLE_EX_DRAWDDARROWS and TBSTYLE_DROPDOWN
      // the right end of the toolbar gets cut off or if it is a
      // vertical toolbar the bottom gets cut off.
      // Fix: CalcSize()
      //
      // From: John R. Shaw (Me)
      // Problem: If you only fix CalcSize() the sizing calculations are
      // still wrong because WrapToolBar() uses the same invalid
      // width value used in CalcSize().
      // Fix: WrapToolBar()

      If you want I could zip up the code and send it to you. There is no garantee that it will solve your problem, but it would give you a good start. INTP

      G 1 Reply Last reply
      0
      • J John R Shaw

        You will need to derive your own class from CToolBar and override some of the functionality. Here are the notes from my code to fix the drop down arrow problem:

        // From: MFC Knowlege base
        // BUG: Resizing CToolbar with Dropdown Arrow Buttons Freezes Apps
        // ID: Q190501

        // From: Microsoft Systems Journal (Aug98CQA.zip)
        // Problem: When using TBSTYLE_EX_DRAWDDARROWS and TBSTYLE_DROPDOWN
        // the right end of the toolbar gets cut off or if it is a
        // vertical toolbar the bottom gets cut off.
        // Fix: CalcSize()
        //
        // From: John R. Shaw (Me)
        // Problem: If you only fix CalcSize() the sizing calculations are
        // still wrong because WrapToolBar() uses the same invalid
        // width value used in CalcSize().
        // Fix: WrapToolBar()

        If you want I could zip up the code and send it to you. There is no garantee that it will solve your problem, but it would give you a good start. INTP

        G Offline
        G Offline
        gokings
        wrote on last edited by
        #3

        Thanks for the information and your offer to zip and send me the code. I will look into the Q article, as well as another possibility. If I think the zipped code would be useful, I'll send you an email. Thanks again for the offer.

        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