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
Solved

How to turn off long hints in TListView

Posted on 2004-04-13
10
964 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree compare node issue 14 125
Mobile Keyboard covers the display of the TMemo 3 96
Firemonkey webbrowser scrollbars ? 1 50
Firemonkey BASS_Init into a thread 17 30
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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