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