source: cprs/branches/tmg-cprs/CPRS-Chart/Orders/fODChangeEvtDisp.pas@ 656

Last change on this file since 656 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 2.9 KB
Line 
1//kt -- Modified with SourceScanner on 8/8/2007
2unit fODChangeEvtDisp;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 fAutoSz, StdCtrls, ORFn, ExtCtrls, ORCtrls, DKLang;
9
10type
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
31function DispOrdersForEventChange(AnOrderList: TList; ACap: string): boolean;
32
33implementation
34
35{$R *.DFM}
36uses rOrders;
37
38function DispOrdersForEventChange(AnOrderList: TList; ACap: string): boolean;
39var
40 frmChangeEventDisp: TfrmChangeEventDisp;
41 i: integer;
42 AnOrder: TOrder;
43begin
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;
54end;
55
56procedure TfrmChangeEventDisp.lstCVOrdersDrawItem(Control: TWinControl;
57 Index: Integer; Rect: TRect; State: TOwnerDrawState);
58var
59 x: string;
60 ARect: TRect;
61begin
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;
77end;
78
79
80procedure TfrmChangeEventDisp.lstCVOrdersMeasureItem(Control: TWinControl;
81 Index: Integer; var AHeight: Integer);
82var
83 x:string;
84 ARect: TRect;
85begin
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;
97end;
98
99procedure TfrmChangeEventDisp.cmdOKClick(Sender: TObject);
100begin
101 inherited;
102 FOKPressed := True;
103 Close;
104end;
105
106procedure TfrmChangeEventDisp.cmdCancelClick(Sender: TObject);
107begin
108 inherited;
109 FOKPressed := False;
110 Close;
111end;
112
113end.
Note: See TracBrowser for help on using the repository browser.