unit Listbob;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TListBob = class(tlistbox)
private
{ Private declarations }
FOnHScroll: TNotifyEvent;
FOnVScroll: TNotifyEvent;
protected
{ Protected declarations }
procedure WMHScroll(var Message: TWMHScroll); message WM_HSCROLL;
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property OnHScroll: TNotifyEvent read FOnHScroll write FOnHScroll;
property OnVScroll: TNotifyEvent read FOnVScroll write FOnVScroll;
end;
procedure Register;
implementation
constructor TListBob.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FOnHScroll := nil;
FOnVScroll := nil;
end;
procedure TListBob.WMHScroll(var Message: TWMHScroll);
{ помните что данное сообщение вызывается дважды!! }
begin
if Assigned(FOnHScroll) then
FOnHScroll(Self);
DefaultHandler(Message);
end;
procedure TListBob.WMVScroll(var Message: TWMHScroll);
{ помните что данное сообщение вызывается дважды!! }
begin
if Assigned(FOnVScroll) then
FOnVScroll(Self);
DefaultHandler(Message);
end;
procedure Register;
begin
RegisterComponents('Dr.Bob', [TListBob]);
end;
end.
|