?
Solved

Event when listbox scollbar used?

Posted on 1998-04-09
4
Medium Priority
?
151 Views
Last Modified: 2010-04-06
I have a listbox on my form, with a pop-up editor I've added on the form.  It shows when you click on an event, and hides when you click outside the editor (ie on the OnExit of the editor).  It pops up over the selected item in the list.  

This works fine until you scroll the list.  There seems to be no way to detect this has happened, and either move the editor accordingly, or hide it.

I need an event, or an easy way to descend from TListBox to publish something, that will notify when the user scrolls the list.

Any ideas?
0
Comment
Question by:bcrotaz
[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
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
inter earned 400 total points
ID: 1361359
Hi there,

  Here it is the modified component you want
//------------------------------------------start on next------------------------------------------------------
  unit SCList;
  interface
  uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls,
    StdCtrls;

  TSCListBox = class(TCustomListBox)
  private
    FOnScroll : TNotifyEvent;
    procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
    procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
  published
    property OnScroll: TNotifyEvent read FOnScroll write FOnScroll;
  end;

  procedure Register;

  implementation

  procedure TSCListBox.WMHScroll(var Message: TWMHScroll);
  begin
    inherited;
    if Assigned(FOnScroll) then FOnScroll(Self);
  end;

  procedure TSCListBox.WMVScroll(var Message: TWMVScroll);
  begin
    inherited;
    if Assigned(FOnScroll) then FOnScroll(Self);
  end;

  procedure Register;
  begin
    RegisterComponents('Samples', [TScListBox]);
  end;

  end.
//------------------------------------------end-------------------------------------------------------
{I hope you know how to add it yo your control panel
Regards,
Igor
0
 
LVL 1

Author Comment

by:bcrotaz
ID: 1361360
Wow!
Thanks - you only actually needed to tell me the names of the messages - no need to put all that extra effort in!

Bryan
0
 
LVL 5

Expert Comment

by:inter
ID: 1361361
You are wellcome friend,

For such small code no need to waste time. Also if it worked as is I be happy, because (I know that the way is correct) but I wrote the code on the fly.

Regards,
Igor
0
 
LVL 1

Author Comment

by:bcrotaz
ID: 1361362
Ta muchly!
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

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…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

762 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