disable TListView tooltip hint

dear all; when TListView is custom drawn/painted,
the underlying native control has no clue about
how it is done, and it calculates the length of
text metrics for the TListItem.Caption (and
TListItem.SubItems.Text) strings based on the
control's default params. This triggers tooltip
window popup showing the string as a hint when
native control thinks the string is too long to
fit the corresponding column width.
How do I stop/prevent it from happening? Steps to
reproduce: drop a TListView, make it look like a
report and populate a few items with captions long
enough to not fit the column width; hover the
mouse over such a long item or subitem and you
will see the hint is displayed showing that text
in full length. If you custom draw these captions
in narrow font, the underlying native still shows
the hints. I'm looking for a VCL-based solution
instead of intercepting internal control messages. TIA. 
Boba.
0
Utf
8/18/2015 4:51:51 AM
📁 embarcadero.cppbuilder.using
📃 1848 articles.
⭐ 1 followers.

💬 1 Replies
👁️‍🗨️ 858 Views


Boba wrote:
> dear all; when TListView is custom drawn/painted,
> the underlying native control has no clue about
> how it is done, and it calculates the length of
> text metrics for the TListItem.Caption (and
> TListItem.SubItems.Text) strings based on the
> control's default params.
It is based on the width of the columns.
> drop a TListView, make it look like a report and populate
> a few items with captions long enough to not fit the
> column width; hover the mouse over such a long item or
> subitem and you will see the hint is displayed showing that
> text in full length.
As it should be.
> If you custom draw these captions in narrow font, the
> underlying native still shows the hints. I'm looking for a
> VCL-based solution instead of intercepting internal control
> messages.
Try using the TListView.OnInfoTip event (which is triggered by the LVN_GETINFOTIP 
notification) to manage the text of the toolhint.  If the tooltip is being 
displayed for a TListItem whose text is not "too long", set the event's InfoTip 
parameter to an empty string.  If that does not solve your issue, you will 
have to handle the LVN_GETINFOTIP notification directly (which you should 
do anyway, as it provides you with the subitem being displayed, which the 
OnInfoTip event does not tell you).
-- 
Remy Lebeau (TeamB)
0
Remy
8/18/2015 11:11:25 PM
Reply: