Solved

Show Hint every Time the Mouse Moves

Posted on 2001-06-14
8
502 Views
Last Modified: 2010-08-05
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
0
Comment
Question by:Shellman
8 Comments
 
LVL 4

Expert Comment

by:DMN
ID: 6191157
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
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6191364
There is a hint listbox (THListBox) which you can use. Written by Alexandre GUILLIEN (AGuillien@csi.com)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6191476
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Shellman
ID: 6191490
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
 

Author Comment

by:Shellman
ID: 6191512
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
 
LVL 4

Expert Comment

by:DMN
ID: 6191675
LMD library (www.lmd.de) has Shell components. Also available some free shell component sets. Try to find it at www.torry.net
0
 
LVL 4

Accepted Solution

by:
DMN earned 100 total points
ID: 6191698
Oh! I forget... Take a look at VIRTUALLISTVIEW.DPR in your Delphi\Demos\Virtual Listview folder. That should help!
0
 

Author Comment

by:Shellman
ID: 6191916
Thanks! Your two comments really helped me.
Now everything works quite fine.

Shellman
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 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