source: cprs/trunk/CPRS-Chart/Orders/fODChangeEvtDisp.pas@ 924

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

Upgrade to version 27

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