-
Notifications
You must be signed in to change notification settings - Fork 34
/
ListBoxEx.pas
60 lines (49 loc) · 1.25 KB
/
ListBoxEx.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
unit ListBoxEx;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TListBoxEx = class (TListBox)
private
{ Private declarations }
FOnMouseLeave: TNotifyEvent;
FOnMouseEnter: TNotifyEvent;
procedure CMMouseEnter(var msg: TMessage);
message CM_MOUSEENTER;
procedure CMMouseLeave(var msg: TMessage);
message CM_MOUSELEAVE;
protected
{ Protected declarations }
procedure DoMouseEnter; dynamic;
procedure DoMouseLeave; dynamic;
public
{ Public declarations }
published
{ Published declarations }
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Additional', [TListBoxEx]);
end;
procedure TListBoxEx.CMMouseEnter(var msg: TMessage);
begin
DoMouseEnter;
end;
procedure TListBoxEx.CMMouseLeave(var msg: TMessage);
begin
DoMouseLeave;
end;
procedure TListBoxEx.DoMouseEnter;
begin
if Assigned(FOnMouseEnter) then FOnMouseEnter(Self);
end;
procedure TListBoxEx.DoMouseLeave;
begin
if Assigned(FOnMouseLeave) then FOnMouseLeave(Self);
end;
end.