3

In Windows, if a column is too narrow to show full text, a tooltip appears inline and can show you the missing text:

enter image description here

It's important to note that hint window is inline with the text being displayed (i.e. it's not "below" the node).

This would be the equivalent of VirtualTreeview HintMode hmToolTip:

  TVTHintMode = (
    hmDefault,            // show the hint of the control
    hmHint,               // show node specific hint string returned by the application
    hmHintAndDefault,     // same as hmHint but show the control's hint if no node is concerned
    hmTooltip             // show the text of the node if it isn't already fully shown
  );
  • hmTooltip: show the text of the node if it isn't already fully shown

And also Hints; not just tooltips

Explorer also has the ability to show a hint, which is a hint windows that floats near, or below the cell being hovered:

enter image description here

This would be the equivalent in VirtualTreeview of hmHint:

  • hmHint: show node specific hint string returned by the application

And you handle the OnGetHint event.

Why not both?

Now comes the piece of resistance: Windows performing both functions, at the same time:

  • showing you the full text (if it's cut off) (ala hmTooltip)
  • as well as allowing me to add more text (ala hmHint)

enter image description here

But, if there is no additional text to show, it should continue to show just the inline tooltip:

enter image description here

And if it's not cut off at just: just the extra text:

enter image description here

I want that!

How can i do that?

Research effort

  • if i set HintMode to hmTooltip, then OnGetHint never fires (and i never get a chance to add custom information)
  • if i set HintMode to hmHint (or hmHintAndDefault), then OnGetHint event fires, but the tree will no longer display the cut-off portion
  • if the HintMode is hmHint, then the displayed hint will never be inline; but instead will always be below the cell

Is such a feature possible? At the very least i assume i'll have to re-invent all the cell measuring to figure out if the inplace text is cut off.

  • but the the only way i can get an OnGetHint event
  • is by setting HintMode to hmHint
  • but if HintMode is hmHint
  • then the hint will never be in-place
  • but if i set HintMode to hmTooltip to make it in-place
  • i'll never get the OnGetHint event
  • goto 10

Bonus Reading

Edit: Clarification

I hate to do this, because it implies an answer or an avenue that could be pursued. But imagine the following truth table:

OnGetHint  IsTreeTextClipped  Hint
=========  =================  ==================
Empty      No                 No hint
Empty      Yes                Inline tooltip
Non-empty  No                 Hint below; shows only GetHint text only
Non-empty  Yes                Hint below; show both TreeText+CRLF+GetHint text

The problem is that you can never have an inline tooltip if OnGetHint is called.

  • you can either your OnGetHint called (hmHint)
  • or you can have an inline tooltip (hmTooltip)
  • but you can never have OnGetHint called, and if it returns nothing, defer to hmTooltip mode

How can i have OnGetHint called with, and if it returns nothing, defer to hmTooltip mode?

Of course, nothing says that OnGetHint has to be involved at all. That was only an example of how get hint text to the VirtualTrees for processing.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
  • 2
    I don't understnd - in your third pic the full text part isn't inline either. You can surely get this with VT by manually adding the full text in OnGetHint? – Uli Gerhardt Apr 29 '19 at 19:56
  • @UliGerhardt Added clarification section to the bottom of the question. Clear now? – Ian Boyd Apr 30 '19 at 13:12
  • Also added a mockup to let you contrast between the two hint window behaviors in the *same* treeview control – Ian Boyd Apr 30 '19 at 13:26
  • 1
    So the `OnGetHint` event should have an additional `var HintMode` parameter? :-) – Uli Gerhardt Apr 30 '19 at 13:29
  • @UliGerhardt That would be the ideal. Or ideally there would be a hint mode `hmHintAndTooltip`. Or, **ideally**, the tree would just call `OnGetHint` when about to show an `hmTooltip`, and show the `hmTooltip` below, rather than inline. But those are all nice pie-in-the-sky ideas. How can i **actually** do it? – Ian Boyd Apr 30 '19 at 13:32

0 Answers0