Solved

Show Hint every Time the Mouse Moves

Posted on 2001-06-14
8
525 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
[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
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
Independent Software Vendors: 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: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

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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