Solved

Event when listbox scollbar used?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

22 Experts available now in Live!

Get 1:1 Help Now