Solved

How to turn off long hints in TListView

Posted on 2004-04-13
10
931 Views
Last Modified: 2012-06-27
"Long hints" being the long straight hints that superimpose the item's text to complete the item text when the item's text is cut short in the listview due to the length of the listview column.

I need to due this because I am using a stayontop form that has a litview in it and these hints are showing up behind the form. (Interestingly, the infotips are not having this problem.)
0
Comment
Question by:bremeski
  • 6
  • 3
10 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10812951

   override Application.OnHint event handler

   procedure TForm1.OnMyHint (Sender : TObject);
   begin
     // what to do when hint should appear
     ....
     // some code here
   end;

   put the like below let's say in FormCreate :

   Application.OnHint := OnMyHint
0
 

Author Comment

by:bremeski
ID: 10813174
This is not the application hint that I am talking about. It's the hint that let's you know what the rest of the text in a listview item's column is if the text ends with ... at the end of it in the listview because the column is too narrow for it.
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10813533

  Press ALT + H and the D. Type TApplication, click on events and select OnHint. Here it is.
  It handles all the controls on the form. If you do not beleive me, here is the description.

Occurs when the mouse pointer moves over a control or menu item that can display a Help Hint.

property OnHint: TNotifyEvent;

Description

Write an OnHint event handler to perform special processing when the mouse pauses over a control or menu item whose Hint property is not an empty string (‘’).

A common use of the OnHint event is to display the value of a control or menu item's Hint property as the text of a status bar (TStatusBar). The Hint property of a control can specify both a short Help Hint and a (usually) longer hint that appears elsewhere because of code in an OnHint event handler.
0
 

Author Comment

by:bremeski
ID: 10813610
I do believe you and this is not what I am talking about. I ahve been programming in Delphi since Delphi 1 and understand teh Application.OnHint property. This is different.

Open your Windows Explorer.
Set the view style to Details.
Resize the Type column until only a few characters are showing for each item.
Place the mouse over some of these Type item's text.
Watch the yellow hint popup right over the item's text to complete it on screen because you cannot see it all from the listview because the column is too narrow.

That is what I am talking about and this is not controlled by the Application.OnHint property. TreeViews do the same thing. I need for this NOT to happen in my listview in my app. I suspect that is possible but I can't find the variable in commctrl...
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 12

Accepted Solution

by:
Ivanov_G earned 250 total points
ID: 10813695

  sorry, my mistake. I red TListBox ...

  I understand. The only decision I think of now is to handle CM_HINTSHOW. In order to do this, you have to write your own component that inherit TListView.

  TMyListView = class(TListView)
  private
     procedure OnShowHint (var Msg : TMessage); message CM_HINTSHOW;
  public
  end;
0
 

Author Comment

by:bremeski
ID: 10813854
CM_HINTSHOW looks like it might be right on. Bu tit controls the InfoTip as will, which I don't want to get rid of.  Looks like the

procedure TCustomListView.CMHintShow(var Message: TMessage);

could be rewritten to include the InfoTip stuff but NOT do this part:

        with HintInfo^ do
        begin
          HintInfo.CursorRect := ItemRect;
          HintInfo.HintStr := InfoTip;
          HintPos.Y := CursorRect.Top + GetSystemMetrics(SM_CYCURSOR);
          HintPos.X := CursorRect.Left + GetSystemMetrics(SM_CXCURSOR);
          HintInfo.HintMaxWidth := ClientWidth;
          Message.Result := 0;

What do you think? Could you post the uni text of a derived MyListView component that takes care of this?
0
 

Author Comment

by:bremeski
ID: 10815505
I meant could you post the Delphi UNIT text...
0
 

Author Comment

by:bremeski
ID: 10816088
I tried deriving TListView to change the behavior of the CMHintShow, but it looks like that is all for the InfoTip feature, so this won't work. Any other ideas?
0
 

Author Comment

by:bremeski
ID: 10827713
This question has been answered in another question I posed to the programming commuity at large.

Actually, this got me looking at doing a

SendMessage(listview.Handle, LVM_SETTOOLTIPS, 0, 0);

The last param is the handle to the tooltip window. By setting it to zero or -1, I have effectively stopped the tooltips, which was my goal.

Question closed.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now