?
Solved

How to turn off long hints in TListView

Posted on 2004-04-13
10
Medium Priority
?
1,034 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

764 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