Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: disable TListView tooltip hint



Permlink Replies: 3 - Last Post: Aug 26, 2015 1:34 AM Last Post By: Boba ½° Threads: [ Previous | Next ]
Boba ½°

Posts: 73
Registered: 12/19/03
disable TListView tooltip hint
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 17, 2015 9:51 PM
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.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: disable TListView tooltip hint
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 18, 2015 4:11 PM   in response to: Boba ½° in response to: Boba ½°
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)
Boba ½°

Posts: 73
Registered: 12/19/03
Re: disable TListView tooltip hint
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 25, 2015 2:51 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
"Remy Lebeau (TeamB)" wrote in message news:729884 at forums dot embarcadero dot com...
... based on the control's default params.

It is based on the width of the columns.

and control HDC params which VCL ignores.

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 ...

you are talking about the hint displayed when TListView.ShowHint
is set to 'true'. In my case, ListView1->ShowHint==false;

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).

no, I am not after the LVN_GETINFOTIP notification and not after
any list view control notifications at all, but rather the ones
triggered by ToolTip itself. If you set ListView1->ShowHint=true;
then you'll see 2 tips showing in concert: 1 is the list item's
Caption and the other is whatever mouse poinetr is over, and if
the mouse happens to be over the item caption, then you will see
2 almost identical hints - this is the ugliest part of what I am
trying to solve.
Boba ½°

Posts: 73
Registered: 12/19/03
Re: disable TListView tooltip hint
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 26, 2015 1:34 AM   in response to: Boba ½° in response to: Boba ½°
... this is the ugliest part of what I am trying to solve.

please see attached a screenshot of it.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02