[456] | 1 | unit fODChangeEvtDisp;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[829] | 7 | fAutoSz, StdCtrls, ORFn, ExtCtrls, ORCtrls, VA508AccessibilityManager;
|
---|
[456] | 8 |
|
---|
| 9 | type
|
---|
| 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 |
|
---|
| 29 | function DispOrdersForEventChange(AnOrderList: TList; ACap: string): boolean;
|
---|
| 30 |
|
---|
| 31 | implementation
|
---|
| 32 |
|
---|
| 33 | {$R *.DFM}
|
---|
| 34 | uses rOrders;
|
---|
| 35 |
|
---|
| 36 | function DispOrdersForEventChange(AnOrderList: TList; ACap: string): boolean;
|
---|
| 37 | var
|
---|
| 38 | frmChangeEventDisp: TfrmChangeEventDisp;
|
---|
| 39 | i: integer;
|
---|
| 40 | AnOrder: TOrder;
|
---|
| 41 | begin
|
---|
| 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;
|
---|
| 52 | end;
|
---|
| 53 |
|
---|
| 54 | procedure TfrmChangeEventDisp.lstCVOrdersDrawItem(Control: TWinControl;
|
---|
| 55 | Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
---|
| 56 | var
|
---|
| 57 | x: string;
|
---|
| 58 | ARect: TRect;
|
---|
| 59 | begin
|
---|
| 60 | inherited;
|
---|
| 61 | x := '';
|
---|
| 62 | ARect := Rect;
|
---|
| 63 | with lstCVOrders do
|
---|
| 64 | begin
|
---|
| 65 | Canvas.FillRect(ARect);
|
---|
[829] | 66 | Canvas.Pen.Color := Get508CompliantColor(clSilver);
|
---|
[456] | 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;
|
---|
| 75 | end;
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | procedure TfrmChangeEventDisp.lstCVOrdersMeasureItem(Control: TWinControl;
|
---|
| 79 | Index: Integer; var AHeight: Integer);
|
---|
| 80 | var
|
---|
| 81 | x:string;
|
---|
| 82 | ARect: TRect;
|
---|
| 83 | begin
|
---|
| 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;
|
---|
| 95 | end;
|
---|
| 96 |
|
---|
| 97 | procedure TfrmChangeEventDisp.cmdOKClick(Sender: TObject);
|
---|
| 98 | begin
|
---|
| 99 | inherited;
|
---|
| 100 | FOKPressed := True;
|
---|
| 101 | Close;
|
---|
| 102 | end;
|
---|
| 103 |
|
---|
| 104 | procedure TfrmChangeEventDisp.cmdCancelClick(Sender: TObject);
|
---|
| 105 | begin
|
---|
| 106 | inherited;
|
---|
| 107 | FOKPressed := False;
|
---|
| 108 | Close;
|
---|
| 109 | end;
|
---|
| 110 |
|
---|
| 111 | end.
|
---|