In Windows, if a column is too narrow to show full text, a tooltip
appears inline and can show you the missing text:
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:
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
)
But, if there is no additional text to show, it should continue to show just the inline tooltip:
And if it's not cut off at just: just the extra text:
I want that!
How can i do that?
Research effort
- if i set HintMode to
hmTooltip
, thenOnGetHint
never fires (and i never get a chance to add custom information) - if i set HintMode to
hmHint
(orhmHintAndDefault
), thenOnGetHint
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.