source: cprs/branches/tmg-cprs/CPRS-Chart/fAlertForward.pas@ 1035

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 3.2 KB
RevLine 
[453]1//kt -- Modified with SourceScanner on 7/8/2007
2unit fAlertForward;
3
4interface
5
6uses Windows, Messages, SysUtils, Classes, Graphics, Forms, Controls,
7 Dialogs, StdCtrls, Buttons, ORCtrls, ORfn, ExtCtrls, fAutoSz, ComCtrls,
8 DKLang;
9
10type
11 TfrmAlertForward = class(TForm)
12 cmdOK: TButton;
13 cmdCancel: TButton;
14 cboSrcList: TORComboBox;
15 DstList: TORListBox;
16 SrcLabel: TLabel;
17 DstLabel: TLabel;
18 pnlBase: TORAutoPanel;
19 memAlert: TMemo;
20 Label1: TLabel;
21 memComment: TMemo;
22 DKLanguageController1: TDKLanguageController;
23 procedure cboSrcListNeedData(Sender: TObject; const StartFrom: String;
24 Direction, InsertAt: Integer);
25 procedure cmdOKClick(Sender: TObject);
26 procedure cmdCancelClick(Sender: TObject);
27 procedure cboSrcListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
28 procedure DstListClick(Sender: TObject);
29 procedure cboSrcListMouseClick(Sender: TObject);
30 procedure FormCreate(Sender: TObject);
31 procedure DstListKeyDown(Sender: TObject; var Key: Word;
32 Shift: TShiftState);
33end;
34
35function ForwardAlertTo(Alert: String): Boolean;
36
37implementation
38
39{$R *.DFM}
40
41uses rCore, uCore;
42
43var XQAID: string;
44
45function ForwardAlertTo(Alert: String): Boolean;
46var
47 frmAlertForward: TfrmAlertForward;
48begin
49 frmAlertForward := TfrmAlertForward.Create(Application);
50 try
51 ResizeAnchoredFormToFont(frmAlertForward);
52 with frmAlertForward do
53 begin
54 memAlert.SetTextBuf(PChar(Piece(Alert, U, 2)));
55 XQAID := Piece(Alert, U, 1);
56 ShowModal;
57 end;
58 finally
59 frmAlertForward.Release;
60 Result := True;
61 end;
62end;
63
64procedure TfrmAlertForward.FormCreate(Sender: TObject);
65begin
66 inherited;
67 cboSrcList.InitLongList('');
68end;
69
70procedure TfrmAlertForward.cboSrcListNeedData(Sender: TObject;
71 const StartFrom: String; Direction, InsertAt: Integer);
72begin
73 (Sender as TORComboBox).ForDataUse(SubSetOfPersons(StartFrom, Direction));
74end;
75
76procedure TfrmAlertForward.cmdCancelClick(Sender: TObject);
77begin
78 Close;
79end;
80
81procedure TfrmAlertForward.cmdOKClick(Sender: TObject);
82var
83 i: integer ;
84 Recip: string;
85begin
86 if DstList.Items.Count = 0 then Exit;
87 for i := 0 to DstList.Items.Count-1 do
88 begin
89 Recip := Piece(DstList.Items[i], U, 1);
90 memComment.Text := StringReplace(memComment.Text, CRLF, ' ', [rfReplaceAll]);
91 ForwardAlert(XQAID, Recip, 'A', memComment.Text);
92 end;
93 Close;
94end;
95
96procedure TfrmAlertForward.DstListClick(Sender: TObject);
97begin
98 if DstList.ItemIndex = -1 then Exit;
99 DstList.Items.Delete(DstList.ItemIndex);
100end;
101
102procedure TfrmAlertForward.cboSrcListKeyDown(Sender: TObject; var Key: Word;
103 Shift: TShiftState);
104begin
105 if Key = VK_SPACE then cboSrcListMouseClick(Self);
106end;
107
108procedure TfrmAlertForward.cboSrcListMouseClick(Sender: TObject);
109begin
110 if cboSrcList.ItemIndex = -1 then Exit;
111 if DstList.SelectByID(cboSrcList.ItemID) = -1 then
112 DstList.Items.Add(cboSrcList.Items[cboSrcList.Itemindex]);
113end;
114
115procedure TfrmAlertForward.DstListKeyDown(Sender: TObject; var Key: Word;
116 Shift: TShiftState);
117begin
118 if Key = VK_SPACE then DstListClick(Self);
119end;
120
121end.
Note: See TracBrowser for help on using the repository browser.