1 | //kt -- Modified with SourceScanner on 8/8/2007
|
---|
2 | unit fODChangeEvtDisp;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
8 | fAutoSz, StdCtrls, ORFn, ExtCtrls, ORCtrls, DKLang;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmChangeEventDisp = class(TfrmAutoSz)
|
---|
12 | lblTop: TMemo;
|
---|
13 | pnlTop: TPanel;
|
---|
14 | lstCVOrders: TCaptionListBox;
|
---|
15 | pnlBottom: TPanel;
|
---|
16 | cmdOK: TButton;
|
---|
17 | cmdCancel: TButton;
|
---|
18 | DKLanguageController1: TDKLanguageController;
|
---|
19 | procedure lstCVOrdersDrawItem(Control: TWinControl; Index: Integer;
|
---|
20 | Rect: TRect; State: TOwnerDrawState);
|
---|
21 | procedure lstCVOrdersMeasureItem(Control: TWinControl; Index: Integer;
|
---|
22 | var AHeight: Integer);
|
---|
23 | procedure cmdOKClick(Sender: TObject);
|
---|
24 | procedure cmdCancelClick(Sender: TObject);
|
---|
25 | private
|
---|
26 | FOKPressed: boolean;
|
---|
27 | public
|
---|
28 | { Public declarations }
|
---|
29 | end;
|
---|
30 |
|
---|
31 | function DispOrdersForEventChange(AnOrderList: TList; ACap: string): boolean;
|
---|
32 |
|
---|
33 | implementation
|
---|
34 |
|
---|
35 | {$R *.DFM}
|
---|
36 | uses rOrders;
|
---|
37 |
|
---|
38 | function DispOrdersForEventChange(AnOrderList: TList; ACap: string): boolean;
|
---|
39 | var
|
---|
40 | frmChangeEventDisp: TfrmChangeEventDisp;
|
---|
41 | i: integer;
|
---|
42 | AnOrder: TOrder;
|
---|
43 | begin
|
---|
44 | frmChangeEventDisp := TFrmChangeEventDisp.Create(Application);
|
---|
45 | frmChangeEventDisp.lblTop.Text := ACap;
|
---|
46 | frmChangeEventDisp.lstCVOrders.Caption := ACap;
|
---|
47 | for i := 0 to AnOrderList.Count - 1 do
|
---|
48 | begin
|
---|
49 | AnOrder := TOrder(AnOrderList[i]);
|
---|
50 | frmChangeEventDisp.lstCVOrders.Items.Add(AnOrder.Text);
|
---|
51 | end;
|
---|
52 | frmChangeEventDisp.ShowModal;
|
---|
53 | Result := frmChangeEventDisp.FOKPressed;
|
---|
54 | end;
|
---|
55 |
|
---|
56 | procedure TfrmChangeEventDisp.lstCVOrdersDrawItem(Control: TWinControl;
|
---|
57 | Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
---|
58 | var
|
---|
59 | x: string;
|
---|
60 | ARect: TRect;
|
---|
61 | begin
|
---|
62 | inherited;
|
---|
63 | x := '';
|
---|
64 | ARect := Rect;
|
---|
65 | with lstCVOrders do
|
---|
66 | begin
|
---|
67 | Canvas.FillRect(ARect);
|
---|
68 | Canvas.Pen.Color := clSilver;
|
---|
69 | Canvas.MoveTo(0, ARect.Bottom - 1);
|
---|
70 | Canvas.LineTo(ARect.Right, ARect.Bottom - 1);
|
---|
71 | if Index < Items.Count then
|
---|
72 | begin
|
---|
73 | x := Items[Index];
|
---|
74 | DrawText(Canvas.handle, PChar(x), Length(x), ARect, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK);
|
---|
75 | end;
|
---|
76 | end;
|
---|
77 | end;
|
---|
78 |
|
---|
79 |
|
---|
80 | procedure TfrmChangeEventDisp.lstCVOrdersMeasureItem(Control: TWinControl;
|
---|
81 | Index: Integer; var AHeight: Integer);
|
---|
82 | var
|
---|
83 | x:string;
|
---|
84 | ARect: TRect;
|
---|
85 | begin
|
---|
86 | inherited;
|
---|
87 | AHeight := MainFontHeight + 3;
|
---|
88 | with lstCVOrders do if Index < Items.Count then
|
---|
89 | begin
|
---|
90 | x := Items[index];
|
---|
91 | ARect := ItemRect(Index);
|
---|
92 | AHeight := DrawText(Canvas.Handle, PChar(x), Length(x), ARect,
|
---|
93 | DT_CALCRECT or DT_LEFT or DT_NOPREFIX or DT_WORDBREAK) + 2;
|
---|
94 | if AHeight > 255 then AHeight := 255;
|
---|
95 | if AHeight < 13 then AHeight := 13;
|
---|
96 | end;
|
---|
97 | end;
|
---|
98 |
|
---|
99 | procedure TfrmChangeEventDisp.cmdOKClick(Sender: TObject);
|
---|
100 | begin
|
---|
101 | inherited;
|
---|
102 | FOKPressed := True;
|
---|
103 | Close;
|
---|
104 | end;
|
---|
105 |
|
---|
106 | procedure TfrmChangeEventDisp.cmdCancelClick(Sender: TObject);
|
---|
107 | begin
|
---|
108 | inherited;
|
---|
109 | FOKPressed := False;
|
---|
110 | Close;
|
---|
111 | end;
|
---|
112 |
|
---|
113 | end.
|
---|