Solved

How to turn off long hints in TListView

Posted on 2004-04-13
10
977 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
Technology Partners: 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 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reconfigure Delphi Install? 2 66
Delphi inherited method 6 80
Delphi Yen format 3 62
RESTRequest Parameter 4 54
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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