Last change
on this file since 1679 was 459, checked in by Kevin Toppenberg, 16 years ago |
Adding foia-cprs branch
|
File size:
1.8 KB
|
Line | |
---|
1 | unit fRemCoverPreview;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
7 | ComCtrls, StdCtrls, ExtCtrls;
|
---|
8 |
|
---|
9 | type
|
---|
10 | TfrmRemCoverPreview = class(TForm)
|
---|
11 | pnlBtns: TPanel;
|
---|
12 | btnOK: TButton;
|
---|
13 | lvMain: TListView;
|
---|
14 | procedure FormCreate(Sender: TObject);
|
---|
15 | procedure lvMainColumnClick(Sender: TObject; Column: TListColumn);
|
---|
16 | procedure lvMainCompare(Sender: TObject; Item1, Item2: TListItem;
|
---|
17 | Data: Integer; var Compare: Integer);
|
---|
18 | private
|
---|
19 | FSortCol: integer;
|
---|
20 | FSortUp: boolean;
|
---|
21 | public
|
---|
22 | { Public declarations }
|
---|
23 | end;
|
---|
24 |
|
---|
25 | implementation
|
---|
26 |
|
---|
27 | {$R *.DFM}
|
---|
28 |
|
---|
29 | procedure TfrmRemCoverPreview.FormCreate(Sender: TObject);
|
---|
30 | begin
|
---|
31 | FSortCol := 2;
|
---|
32 | FSortUp := TRUE;
|
---|
33 | end;
|
---|
34 |
|
---|
35 | procedure TfrmRemCoverPreview.lvMainColumnClick(Sender: TObject;
|
---|
36 | Column: TListColumn);
|
---|
37 | begin
|
---|
38 | if FSortCol <> Column.Tag then
|
---|
39 | FSortCol := Column.Tag
|
---|
40 | else
|
---|
41 | FSortUp := not FSortUp;
|
---|
42 | lvMain.CustomSort(nil, 0);
|
---|
43 | end;
|
---|
44 |
|
---|
45 | procedure TfrmRemCoverPreview.lvMainCompare(Sender: TObject; Item1,
|
---|
46 | Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
47 | var
|
---|
48 | i: integer;
|
---|
49 | odr: array[1..2] of integer;
|
---|
50 | s1, s2: string;
|
---|
51 |
|
---|
52 | begin
|
---|
53 | case FSortCol of
|
---|
54 | 1: begin
|
---|
55 | odr[1] := 1;
|
---|
56 | odr[2] := 2;
|
---|
57 | end;
|
---|
58 |
|
---|
59 | 2: begin
|
---|
60 | odr[1] := 2;
|
---|
61 | odr[2] := 1;
|
---|
62 | end;
|
---|
63 | end;
|
---|
64 | Compare := 0;
|
---|
65 | for i := 1 to 2 do
|
---|
66 | begin
|
---|
67 | case odr[i] of
|
---|
68 | 1: begin
|
---|
69 | s1 := Item1.Caption;
|
---|
70 | s2 := Item2.Caption;
|
---|
71 | end;
|
---|
72 |
|
---|
73 | 2: begin
|
---|
74 | s1 := Item1.SubItems[1];
|
---|
75 | s2 := Item2.SubItems[1];
|
---|
76 | end;
|
---|
77 | end;
|
---|
78 | Compare := CompareText(s1, s2);
|
---|
79 | if Compare <> 0 then break;
|
---|
80 | end;
|
---|
81 | if not FSortUp then
|
---|
82 | Compare := -Compare;
|
---|
83 | end;
|
---|
84 |
|
---|
85 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.