CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2005
    Posts
    12

    Disabling a toolbar button with longish text

    Hello... I originally posted this in the Visual C++ forum by mistake, so I'm reposting here in a more appropriate forum. I apologize if you have read this before but I hope I get to the right people this time.


    I have recently added a new toolbar to my app -- a list/flat/transparent toolbar control. It is working fine in general, but I have encountered a problem when disabling a button that has longish text to the right of the icon.

    It seems that even though the toolbar is accurately remembering the width of my button, it is clipping the text when disabled *only*. Attached is a screenshot that demonstrates the problem.

    Though in the screenshot it seems that it gets cut off per letter, my original toolbar had letters cut off halfway.


    I have tried setting the draw text flag DT_CLIP and DT_CALCRECT, both seperately and together, but neither have resolved my issue.



    Has anybody experienced this before? Does anybody know a solution without customdrawing the toolbar?

    Thanks in advance,
    - Richard
    Attached Images Attached Images

  2. #2
    Join Date
    May 2004
    Location
    Michigan, United States
    Posts
    457

    Re: Disabling a toolbar button with longish text

    Never seen that before but are you allowing the toolbar to size the buttons itself (TB_AUTOSIZE, I think)? If so, what happens if you manually specify the width of the button?
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  3. #3
    Join Date
    Jun 2005
    Posts
    12

    Re: Disabling a toolbar button with longish text

    Hey Bond, thanks for the quick reply!

    The buttons do have the BTNS_AUTOSIZE style set.

    Manually specifying the width of the button isn't something that would be easily done in my code right now, but I will give it a shot tomorrow. Today's getting late and I have some errands to run.

    Thanks again, I'll be back with what happened.
    - Richard

  4. #4
    Join Date
    Jun 2005
    Posts
    12

    Re: Disabling a toolbar button with longish text

    I tried setting my first button's size with TB_SETBUTTONINFO, with LPIF_SIZE as dwMask, setting cx to 200. While it does make my button much larger, the disabled text is still clipped at the same position it was before.


    I'm really thinking this is a problem with the Windows toolbar...

  5. #5
    Join Date
    Jun 2005
    Posts
    12

    Re: Disabling a toolbar button with longish text

    Well, for now I'll be omitting the text -- but if anybody knows a solution to this that lets me keep the text, please let me know!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured