Show Hint every Time the Mouse Moves

Hi!
I have a Listbox with some entrys. Now I want that everytime the user moves the mouse over a new entry a hint pops up and displays the whole content of the item of the listbox. (Like in the windows explorer, when a Filename is too long. I want exactly this).

The code i have so far just changes the hint property of the Listbox, but the hint is only displayed once, when the user enters the Listbox with the mouse, but no more when he moves it. I have to go out with the mouse every time, then a new Hint is displayed.

This is the code I have so far:

procedure TForm1.lb2MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var temp:integer;
begin
  with Sender as TListbox do begin
    temp:=ItemAtPos(Point(X, Y), true);
    if temp=-1 then begin
      Hint:='';
    end else begin
      Hint:=Items[temp];
    end;
  end;
end;

--

There is a second problem in my project: I need to display a directory structure, best with a treeview and a listview like the windows explorer. The only solution i've found are the win3.1 Components (Filelistbox,...) Is there a better way to realize this?

Please help!
Shellman
ShellmanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
DMNConnect With a Mentor Commented:
Oh! I forget... Take a look at VIRTUALLISTVIEW.DPR in your Delphi\Demos\Virtual Listview folder. That should help!
0
 
DMNCommented:
Here is the simple sample:

procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var temp:integer;
begin
 with Sender as TListbox do begin
   temp:=ItemAtPos(Point(X, Y), true);
   if Temp>=0 then begin
     Hint:=Items[temp];
     Application.ActivateHint(Listbox1.ClientToScreen(Point(X,Y)));
   end;
 end;
end;
0
 
FrodoBegginsCommented:
There is a hint listbox (THListBox) which you can use. Written by Alexandre GUILLIEN (AGuillien@csi.com)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
kretzschmarCommented:
You could also use TTreeView
(with a bit property adjustments it looks like a listbox and
you have the hint bahaviour as you want)
0
 
ShellmanAuthor Commented:
Hi again!
It works fine, thanks!
Do you possibly have a solution for my second problem? Is there a better way to select a file, then the Win3.1 Controls?
0
 
ShellmanAuthor Commented:
I used the sollution of DMN. This works great. It's easy and exactly what I wanted. I don't want to exchange my listbox and the hint listbox is too much work ;)

Shellman
0
 
DMNCommented:
LMD library (www.lmd.de) has Shell components. Also available some free shell component sets. Try to find it at www.torry.net
0
 
ShellmanAuthor Commented:
Thanks! Your two comments really helped me.
Now everything works quite fine.

Shellman
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.