source: cprs/branches/foia-cprs/CPRS-Chart/fAlertForward.pas@ 1075

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

Adding foia-cprs branch

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