ToolBar text with BTNS_SHOWTEXT
-
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. -
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.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
-
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
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?