Solved

Show Hint every Time the Mouse Moves

Posted on 2001-06-14
8
492 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
Comment Utility
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
Comment Utility
There is a hint listbox (THListBox) which you can use. Written by Alexandre GUILLIEN (AGuillien@csi.com)
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
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
 

Author Comment

by:Shellman
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:Shellman
Comment Utility
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
Comment Utility
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
Comment Utility
Oh! I forget... Take a look at VIRTUALLISTVIEW.DPR in your Delphi\Demos\Virtual Listview folder. That should help!
0
 

Author Comment

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

Shellman
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now