Solved

Event when listbox scollbar used?

Posted on 1998-04-09
4
142 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
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
inter earned 100 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

20 Experts available now in Live!

Get 1:1 Help Now