none
AutoEllipsis on Button class produces unwanted tooltips. Can this be stopped? RRS feed

  • General discussion

  • I have found by experiment that if a Button has the AutoEllipsis property set to True and .NET thinks that part of the text is missing, hovering the mouse over the button displays a tooltip giving the full text. This is undoubtedly helpful but there are three problems with it:

    1) It's not documented anywhere that I can see. This is a bit silly.

    2) If the button has an associated active tooltip, the automatic one sometimes overlays it on the window. This is a pain.

    3) .NET doesn't always get it right. If the text is wrapped, the tooltip appears even though there's nothing missing. Also, even one line of text produces the tooltip if it just fits in the button. This is even sillier.

    Has anyone else noticed this, and is there a way of stopping the tooltip appearing? My program wants the real one to be visible?

    Here are a couple of screenshots:


    Peter


    • Edited by ptoye Thursday, April 4, 2019 10:02 AM Added second screenshot
    Wednesday, April 3, 2019 11:35 AM

All replies

  • Has anyone else noticed this, and is there a way of stopping the tooltip appearing? My program wants the real one to be visible?

    A way is with a WH_CBT hook (by closing the tooltip when nCode = HCBT_CREATEWND)

    (tested on Windows 10 with VS 2015)

    Thursday, April 4, 2019 9:48 AM
  • Thanks for the idea. But as the program is written in VB I'm not sure I can even insert a hook! And, even if I can, how do I find the tooltip as it's controlled by Windows (or .Net) rather than the program?

    Also, it's the text in the buttons which the program changes, and occasionally triggers this behaviour. So a hook which depends on window resizing won't be triggered.


    Peter


    • Edited by ptoye Thursday, April 4, 2019 10:04 AM Added 2nd para
    Thursday, April 4, 2019 10:01 AM
  • I tested in VB.NET

    In the Hook, I tested if the window class name Contains("tooltips") when a window is created (with GetClassName)

    (.NET re-creates the tooltip for AutoEllipsis on MouseEnter if it has been destroyed that's why it must be closed every time it is created)

    Thursday, April 4, 2019 10:12 AM