-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathustringlistpro.pas
55 lines (40 loc) · 1.06 KB
/
ustringlistpro.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
unit uStringListPro;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
TStringListProgressCallback = procedure of object;
{ TStringListProgress }
TStringListProgress = class(TStringList)
private
FCallBack:TStringListProgressCallback;
public
procedure Sort; override;
procedure CustomSort(CompareFn: TStringListSortCompare); override;
function AddObject(const S: string; AObject: TObject): Integer; override;
overload;
property Callback:TStringListProgressCallback read FCallBack write FCallBack;
end;
implementation
{ TStringListProgress }
procedure TStringListProgress.Sort;
begin
inherited Sort;
if Assigned(FCallBack) then
FCallBack;
end;
procedure TStringListProgress.CustomSort(CompareFn: TStringListSortCompare);
begin
inherited CustomSort(CompareFn);
if Assigned(FCallBack) then
FCallBack;
end;
function TStringListProgress.AddObject(const S: string; AObject: TObject
): Integer;
begin
Result:=inherited AddObject(S, AObject);
if Assigned(FCallBack) then
FCallBack;
end;
end.