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 text with BTNS_SHOWTEXT

ToolBar text with BTNS_SHOWTEXT

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++databasevisual-studiographics
3 Posts 2 Posters 1 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
    armentage
    wrote on last edited by
    #1

    I'm trying to put text into an MFC CToolBar, and am having problems with end of my tool bar getting cut off. What's happening is that app is computing the size of the toolbar WITHOUT the text, just the width of the icons/separators, so the toolbar ends up too narrow. I'm using Visual Studio 6.0 SP5, with IE6.0 installed on my system. Here's the code I am using: DWORD dwExStyle = TBSTYLE_EX_DRAWDDARROWS|TBSTYLE_EX_MIXEDBUTTONS ; tbar.GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, dwExStyle); int index = CommandToIndex(IDM_CALCULATE); WORD dwStyle = tbar.GetButtonStyle(index); dwStyle |= BTNS_SHOWTEXT|BTNS_AUTOSIZE; tbar.SetButtonStyle(index, dwStyle); tbar.SetButtonText(index, "Calculate"); Some info: BTNS_SHOWTEXT is NOT defined by the MFC/Win32 header files that are installed on my system. I had #define BTNS_SHOWTEXT 0x40 to get this to work. I found many references to it on MSDN, and google'd for its value. I understand it will only work on systems that have IE5.0 or better. What I'm guessing is that the MFC CToolBar implements the CalcSize function using assumptions about IE4.0; rather than calling CToolBarCtrl::GetItemRect, its assuming the size of each icon by using its bitmap size + padding. The BTNS_SHOWTEXT option is new and the circa 1998 (IE4 was just released) MFC just doesn't know to deal with it. Thing is, I can't find any threads or discussions on what to do in this situation. I can't find a place to download a set of Win32 headers that match the new ComCtl32.dll v5.8, or any sort of MFC patches to expore the v5.8 functionality to VC6.0 Any help would be greatly appreciate. I can't switch to VC.NET (as much as I'd love to) because my company likes to drag it's feet when it comes to upgrading development tools.

    M 1 Reply Last reply
    0
    • A armentage

      I'm trying to put text into an MFC CToolBar, and am having problems with end of my tool bar getting cut off. What's happening is that app is computing the size of the toolbar WITHOUT the text, just the width of the icons/separators, so the toolbar ends up too narrow. I'm using Visual Studio 6.0 SP5, with IE6.0 installed on my system. Here's the code I am using: DWORD dwExStyle = TBSTYLE_EX_DRAWDDARROWS|TBSTYLE_EX_MIXEDBUTTONS ; tbar.GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, dwExStyle); int index = CommandToIndex(IDM_CALCULATE); WORD dwStyle = tbar.GetButtonStyle(index); dwStyle |= BTNS_SHOWTEXT|BTNS_AUTOSIZE; tbar.SetButtonStyle(index, dwStyle); tbar.SetButtonText(index, "Calculate"); Some info: BTNS_SHOWTEXT is NOT defined by the MFC/Win32 header files that are installed on my system. I had #define BTNS_SHOWTEXT 0x40 to get this to work. I found many references to it on MSDN, and google'd for its value. I understand it will only work on systems that have IE5.0 or better. What I'm guessing is that the MFC CToolBar implements the CalcSize function using assumptions about IE4.0; rather than calling CToolBarCtrl::GetItemRect, its assuming the size of each icon by using its bitmap size + padding. The BTNS_SHOWTEXT option is new and the circa 1998 (IE4 was just released) MFC just doesn't know to deal with it. Thing is, I can't find any threads or discussions on what to do in this situation. I can't find a place to download a set of Win32 headers that match the new ComCtl32.dll v5.8, or any sort of MFC patches to expore the v5.8 functionality to VC6.0 Any help would be greatly appreciate. I can't switch to VC.NET (as much as I'd love to) because my company likes to drag it's feet when it comes to upgrading development tools.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      I wouldn't be surprised if your assessment is right, considering that MFC 6 is so old and pre-dates even IE 5. As for getting the newest headers, download the Platform SDK (see the VC forum FAQ for details on doing this) --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

      A 1 Reply Last reply
      0
      • M Michael Dunn

        I wouldn't be surprised if your assessment is right, considering that MFC 6 is so old and pre-dates even IE 5. As for getting the newest headers, download the Platform SDK (see the VC forum FAQ for details on doing this) --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--= NO CARRIER

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

        Michael Dunn wrote: considering that MFC 6 is so old and pre-dates even IE 5 Do you happen to know if the MFC that ships with VC.NET has been imrpoved (updated) to expose more of the new ComCtl32 features? Maybe not this problem specifically, but how about images in CListCtrls or the new thumbnails view, etc. Even more off-topic, is this one of the reasons everyone seems to be using WTL now a days?

        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