Index: cprs/trunk/CPRS-Chart/fAlertForward.pas
===================================================================
--- cprs/trunk/CPRS-Chart/fAlertForward.pas	(revision 456)
+++ cprs/trunk/CPRS-Chart/fAlertForward.pas	(revision 830)
@@ -4,8 +4,9 @@
 
 uses Windows, Messages, SysUtils, Classes, Graphics, Forms, Controls,
-  Dialogs, StdCtrls, Buttons, ORCtrls, ORfn, ExtCtrls, fAutoSz, ComCtrls;
+  Dialogs, StdCtrls, Buttons, ORCtrls, ORfn, ExtCtrls, fAutoSz, ComCtrls, fBase508Form,
+  VA508AccessibilityManager;
 
 type
-  TfrmAlertForward = class(TForm)
+  TfrmAlertForward = class(TfrmBase508Form)
     cmdOK: TButton;
     cmdCancel: TButton;
@@ -18,4 +19,9 @@
     Label1: TLabel;
     memComment: TMemo;
+    btnAddAlert: TButton;
+    btnRemoveAlertFwrd: TButton;
+    btnRemoveAllAlertFwrd: TButton;
+    procedure btnRemoveAlertFwrdClick(Sender: TObject);
+    procedure btnAddAlertClick(Sender: TObject);
     procedure cboSrcListNeedData(Sender: TObject; const StartFrom: String;
       Direction, InsertAt: Integer);
@@ -23,12 +29,15 @@
     procedure cmdCancelClick(Sender: TObject);
     procedure cboSrcListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
-    procedure DstListClick(Sender: TObject);
     procedure cboSrcListMouseClick(Sender: TObject);
     procedure FormCreate(Sender: TObject);
-    procedure DstListKeyDown(Sender: TObject; var Key: Word;
-      Shift: TShiftState);
-end;
+    procedure cboSrcListChange(Sender: TObject);
+    procedure DstListChange(Sender: TObject);
+    procedure btnRemoveAllAlertFwrdClick(Sender: TObject);
+  private
+    RemovingAll: boolean;
+  end;
 
 function ForwardAlertTo(Alert: String): Boolean;
+
 
 implementation
@@ -36,5 +45,9 @@
 {$R *.DFM}
 
-uses rCore, uCore;
+uses rCore, uCore, VA508AccessibilityRouter;
+
+const
+    TX_DUP_RECIP = 'You have already selected that recipient.';
+    TX_RECIP_CAP = 'Error adding recipient';
 
 var  XQAID: string;
@@ -62,5 +75,7 @@
 begin
   inherited;
-  cboSrcList.InitLongList('');
+  if ScreenReaderSystemActive then
+    memAlert.TabStop := TRUE;
+  cboSrcList.InitLongList('');  
 end;
 
@@ -81,5 +96,5 @@
   Recip: string;
 begin
-  if DstList.Items.Count = 0 then Exit;
+
   for i := 0 to DstList.Items.Count-1 do
   begin
@@ -91,8 +106,67 @@
 end;
 
-procedure TfrmAlertForward.DstListClick(Sender: TObject);
+procedure TfrmAlertForward.DstListChange(Sender: TObject);
+var
+  HasFocus: boolean;
 begin
-  if DstList.ItemIndex = -1 then Exit;
-  DstList.Items.Delete(DstList.ItemIndex);
+  inherited;
+  if DstList.SelCount = 1 then
+    if Piece(DstList.Items[0], '^', 1) = '' then
+    begin
+      btnRemoveAlertFwrd.Enabled := false;
+      btnRemoveAllAlertFwrd.Enabled := false;
+      exit;
+    end;
+  HasFocus := btnRemoveAlertFwrd.Focused;
+  if Not HasFocus then
+    HasFocus := btnRemoveAllAlertFwrd.Focused;
+  btnRemoveAlertFwrd.Enabled := DstList.SelCount > 0;
+  btnRemoveAllAlertFwrd.Enabled := DstList.Items.Count > 0;
+  if HasFocus and (DstList.SelCount = 0) then
+    btnAddAlert.SetFocus; 
+end;
+
+procedure TfrmAlertForward.btnAddAlertClick(Sender: TObject);
+begin
+  inherited;
+  cboSrcListMouseClick(btnAddAlert);
+end;
+
+procedure TfrmAlertForward.btnRemoveAlertFwrdClick(Sender: TObject);
+var
+  i: integer;
+begin
+  with DstList do
+    begin
+      if ItemIndex = -1 then exit ;
+      for i := Items.Count-1 downto 0 do
+        if Selected[i] then
+        begin
+          if ScreenReaderSystemActive and (not RemovingAll) then
+            GetScreenReader.Speak(Piece(DstList.Items[i],U,2) +
+            ' Removed from ' + DstLabel.Caption);
+          Items.Delete(i) ;
+        end;
+    end;
+end;
+
+procedure TfrmAlertForward.btnRemoveAllAlertFwrdClick(Sender: TObject);
+begin
+  inherited;
+  DstList.SelectAll;
+  RemovingAll := TRUE;
+  try
+    btnRemoveAlertFwrdClick(self);
+    if ScreenReaderSystemActive then
+      GetScreenReader.Speak(DstLabel.Caption + ' Cleared');
+  finally
+    RemovingAll := FALSE;
+  end;
+end;
+
+procedure TfrmAlertForward.cboSrcListChange(Sender: TObject);
+begin
+  inherited;
+  btnAddAlert.Enabled := CboSrcList.ItemIndex > -1;
 end;
 
@@ -100,18 +174,24 @@
   Shift: TShiftState);
 begin
-  if Key = VK_SPACE then cboSrcListMouseClick(Self);
+  if Key = VK_RETURN then
+  begin
+     cboSrcListMouseClick(Self);
+  end;
 end;
 
 procedure TfrmAlertForward.cboSrcListMouseClick(Sender: TObject);
 begin
-  if cboSrcList.ItemIndex = -1 then Exit;
-  if DstList.SelectByID(cboSrcList.ItemID) = -1 then
-    DstList.Items.Add(cboSrcList.Items[cboSrcList.Itemindex]);
-end;
-
-procedure TfrmAlertForward.DstListKeyDown(Sender: TObject; var Key: Word;
-  Shift: TShiftState);
-begin
-  if Key = VK_SPACE then DstListClick(Self);
+  if cboSrcList.ItemIndex = -1 then exit;
+  if (DstList.SelectByID(cboSrcList.ItemID) <> -1) then
+    begin
+      InfoBox(TX_DUP_RECIP, TX_RECIP_CAP, MB_OK or MB_ICONWARNING);
+      Exit;
+    end;
+  DstList.Items.Add(cboSrcList.Items[cboSrcList.Itemindex]);
+  if ScreenReaderSystemActive then
+    GetScreenReader.Speak(Piece(cboSrcList.Items[cboSrcList.Itemindex],U,2) +
+      ' Added to ' + DstLabel.Caption);
+  btnRemoveAlertFwrd.Enabled := DstList.SelCount > 0;
+  btnRemoveAllAlertFwrd.Enabled := DstList.Items.Count > 0;
 end;
 
