Solved

Event when listbox scollbar used?

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

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

838 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