Solved

How to turn off long hints in TListView

Posted on 2004-04-13
10
956 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 111
Intraweb download file link ? 1 132
Run video youtube webbrowse 10 61
Find and Replace Stream with 0s 8 61
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

816 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

7 Experts available now in Live!

Get 1:1 Help Now