[453] | 1 | //kt -- Modified with SourceScanner on 7/8/2007
|
---|
| 2 | unit fAlertForward;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses Windows, Messages, SysUtils, Classes, Graphics, Forms, Controls,
|
---|
| 7 | Dialogs, StdCtrls, Buttons, ORCtrls, ORfn, ExtCtrls, fAutoSz, ComCtrls,
|
---|
| 8 | DKLang;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 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);
|
---|
| 33 | end;
|
---|
| 34 |
|
---|
| 35 | function ForwardAlertTo(Alert: String): Boolean;
|
---|
| 36 |
|
---|
| 37 | implementation
|
---|
| 38 |
|
---|
| 39 | {$R *.DFM}
|
---|
| 40 |
|
---|
| 41 | uses rCore, uCore;
|
---|
| 42 |
|
---|
| 43 | var XQAID: string;
|
---|
| 44 |
|
---|
| 45 | function ForwardAlertTo(Alert: String): Boolean;
|
---|
| 46 | var
|
---|
| 47 | frmAlertForward: TfrmAlertForward;
|
---|
| 48 | begin
|
---|
| 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;
|
---|
| 62 | end;
|
---|
| 63 |
|
---|
| 64 | procedure TfrmAlertForward.FormCreate(Sender: TObject);
|
---|
| 65 | begin
|
---|
| 66 | inherited;
|
---|
| 67 | cboSrcList.InitLongList('');
|
---|
| 68 | end;
|
---|
| 69 |
|
---|
| 70 | procedure TfrmAlertForward.cboSrcListNeedData(Sender: TObject;
|
---|
| 71 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
| 72 | begin
|
---|
| 73 | (Sender as TORComboBox).ForDataUse(SubSetOfPersons(StartFrom, Direction));
|
---|
| 74 | end;
|
---|
| 75 |
|
---|
| 76 | procedure TfrmAlertForward.cmdCancelClick(Sender: TObject);
|
---|
| 77 | begin
|
---|
| 78 | Close;
|
---|
| 79 | end;
|
---|
| 80 |
|
---|
| 81 | procedure TfrmAlertForward.cmdOKClick(Sender: TObject);
|
---|
| 82 | var
|
---|
| 83 | i: integer ;
|
---|
| 84 | Recip: string;
|
---|
| 85 | begin
|
---|
| 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;
|
---|
| 94 | end;
|
---|
| 95 |
|
---|
| 96 | procedure TfrmAlertForward.DstListClick(Sender: TObject);
|
---|
| 97 | begin
|
---|
| 98 | if DstList.ItemIndex = -1 then Exit;
|
---|
| 99 | DstList.Items.Delete(DstList.ItemIndex);
|
---|
| 100 | end;
|
---|
| 101 |
|
---|
| 102 | procedure TfrmAlertForward.cboSrcListKeyDown(Sender: TObject; var Key: Word;
|
---|
| 103 | Shift: TShiftState);
|
---|
| 104 | begin
|
---|
| 105 | if Key = VK_SPACE then cboSrcListMouseClick(Self);
|
---|
| 106 | end;
|
---|
| 107 |
|
---|
| 108 | procedure TfrmAlertForward.cboSrcListMouseClick(Sender: TObject);
|
---|
| 109 | begin
|
---|
| 110 | if cboSrcList.ItemIndex = -1 then Exit;
|
---|
| 111 | if DstList.SelectByID(cboSrcList.ItemID) = -1 then
|
---|
| 112 | DstList.Items.Add(cboSrcList.Items[cboSrcList.Itemindex]);
|
---|
| 113 | end;
|
---|
| 114 |
|
---|
| 115 | procedure TfrmAlertForward.DstListKeyDown(Sender: TObject; var Key: Word;
|
---|
| 116 | Shift: TShiftState);
|
---|
| 117 | begin
|
---|
| 118 | if Key = VK_SPACE then DstListClick(Self);
|
---|
| 119 | end;
|
---|
| 120 |
|
---|
| 121 | end.
|
---|