source: cprs/trunk/CPRS-Chart/fRemCoverPreview.pas@ 1142

Last change on this file since 1142 was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 1.8 KB
Line 
1unit fRemCoverPreview;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 ComCtrls, StdCtrls, ExtCtrls, fBase508Form, VA508AccessibilityManager;
8
9type
10 TfrmRemCoverPreview = class(TfrmBase508Form)
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
25implementation
26
27{$R *.DFM}
28
29procedure TfrmRemCoverPreview.FormCreate(Sender: TObject);
30begin
31 FSortCol := 2;
32 FSortUp := TRUE;
33end;
34
35procedure TfrmRemCoverPreview.lvMainColumnClick(Sender: TObject;
36 Column: TListColumn);
37begin
38 if FSortCol <> Column.Tag then
39 FSortCol := Column.Tag
40 else
41 FSortUp := not FSortUp;
42 lvMain.CustomSort(nil, 0);
43end;
44
45procedure TfrmRemCoverPreview.lvMainCompare(Sender: TObject; Item1,
46 Item2: TListItem; Data: Integer; var Compare: Integer);
47var
48 i: integer;
49 odr: array[1..2] of integer;
50 s1, s2: string;
51
52begin
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;
83end;
84
85end.
Note: See TracBrowser for help on using the repository browser.