Solved

Event when listbox scollbar used?

Posted on 1998-04-09
4
145 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

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…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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