| 1 | unit fExam;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses
 | 
|---|
| 6 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
| 7 |   fPCEBase, StdCtrls, ORCtrls, CheckLst, ExtCtrls, Buttons, uPCE, rPCE, ORFn,
 | 
|---|
| 8 |   fPCELex, fPCEOther, ComCtrls, fPCEBaseMain, VA508AccessibilityManager;
 | 
|---|
| 9 | 
 | 
|---|
| 10 | type
 | 
|---|
| 11 |   TfrmExams = class(TfrmPCEBaseMain)
 | 
|---|
| 12 |     lblExamResults: TLabel;
 | 
|---|
| 13 |     cboExamResults: TORComboBox;
 | 
|---|
| 14 |     procedure cboExamResultsChange(Sender: TObject);
 | 
|---|
| 15 |     procedure FormCreate(Sender: TObject);
 | 
|---|
| 16 |   private
 | 
|---|
| 17 |   protected
 | 
|---|
| 18 |     procedure UpdateNewItemStr(var x: string); override;
 | 
|---|
| 19 |     procedure UpdateControls; override;
 | 
|---|
| 20 |   public   
 | 
|---|
| 21 |   end;
 | 
|---|
| 22 | 
 | 
|---|
| 23 | var
 | 
|---|
| 24 |   frmExams: TfrmExams;
 | 
|---|
| 25 | 
 | 
|---|
| 26 | implementation
 | 
|---|
| 27 | 
 | 
|---|
| 28 | {$R *.DFM}
 | 
|---|
| 29 | 
 | 
|---|
| 30 | uses
 | 
|---|
| 31 |   fEncounterFrame, VA508AccessibilityRouter;
 | 
|---|
| 32 | 
 | 
|---|
| 33 | procedure TfrmExams.cboExamResultsChange(Sender: TObject);
 | 
|---|
| 34 | var
 | 
|---|
| 35 |   i: integer;
 | 
|---|
| 36 | 
 | 
|---|
| 37 | begin
 | 
|---|
| 38 |   if(NotUpdating) and (cboExamResults.Text <> '') then
 | 
|---|
| 39 |   begin
 | 
|---|
| 40 |     for i := 0 to lbGrid.Items.Count-1 do
 | 
|---|
| 41 |       if(lbGrid.Selected[i]) then
 | 
|---|
| 42 |         TPCEExams(lbGrid.Items.Objects[i]).Results := cboExamResults.ItemID;
 | 
|---|
| 43 |     GridChanged;
 | 
|---|
| 44 |   end;
 | 
|---|
| 45 | end;
 | 
|---|
| 46 | 
 | 
|---|
| 47 | procedure TfrmExams.FormCreate(Sender: TObject);
 | 
|---|
| 48 | begin
 | 
|---|
| 49 |   inherited;
 | 
|---|
| 50 |   FTabName := CT_XamNm;
 | 
|---|
| 51 |   FPCEListCodesProc := ListExamsCodes;
 | 
|---|
| 52 |   FPCEItemClass := TPCEExams;
 | 
|---|
| 53 |   FPCECode := 'XAM';
 | 
|---|
| 54 |   PCELoadORCombo(cboExamResults);
 | 
|---|
| 55 | end;
 | 
|---|
| 56 | 
 | 
|---|
| 57 | procedure TfrmExams.UpdateNewItemStr(var x: string);
 | 
|---|
| 58 | begin
 | 
|---|
| 59 |   SetPiece(x, U, pnumExamResults, NoPCEValue);
 | 
|---|
| 60 | end;
 | 
|---|
| 61 | 
 | 
|---|
| 62 | procedure TfrmExams.UpdateControls;
 | 
|---|
| 63 | var
 | 
|---|
| 64 |   ok, First: boolean;
 | 
|---|
| 65 |   SameR: boolean;
 | 
|---|
| 66 |   i: integer;
 | 
|---|
| 67 |   Res: string;
 | 
|---|
| 68 |   Obj: TPCEExams;
 | 
|---|
| 69 | 
 | 
|---|
| 70 | begin
 | 
|---|
| 71 |   inherited;
 | 
|---|
| 72 |   if(NotUpdating) then
 | 
|---|
| 73 |   begin
 | 
|---|
| 74 |     BeginUpdate;
 | 
|---|
| 75 |     try
 | 
|---|
| 76 |       ok := (lbGrid.SelCount > 0);
 | 
|---|
| 77 |       lblExamResults.Enabled := ok;
 | 
|---|
| 78 |       cboExamResults.Enabled := ok;
 | 
|---|
| 79 |       if(ok) then
 | 
|---|
| 80 |       begin
 | 
|---|
| 81 |         First := TRUE;
 | 
|---|
| 82 |         SameR := TRUE;
 | 
|---|
| 83 |         Res := NoPCEValue;
 | 
|---|
| 84 |         for i := 0 to lbGrid.Items.Count-1 do
 | 
|---|
| 85 |         begin
 | 
|---|
| 86 |           if lbGrid.Selected[i] then
 | 
|---|
| 87 |           begin
 | 
|---|
| 88 |             Obj := TPCEExams(lbGrid.Items.Objects[i]);
 | 
|---|
| 89 |             if(First) then
 | 
|---|
| 90 |             begin
 | 
|---|
| 91 |               First := FALSE;
 | 
|---|
| 92 |               Res := Obj.Results;
 | 
|---|
| 93 |             end
 | 
|---|
| 94 |             else
 | 
|---|
| 95 |             begin
 | 
|---|
| 96 |               if(SameR) then
 | 
|---|
| 97 |                 SameR := (Res = Obj.Results);
 | 
|---|
| 98 |             end;
 | 
|---|
| 99 |           end;
 | 
|---|
| 100 |         end;
 | 
|---|
| 101 |         if(SameR) then
 | 
|---|
| 102 |           cboExamResults.SelectByID(Res)
 | 
|---|
| 103 |         else
 | 
|---|
| 104 |           cboExamResults.Text := '';
 | 
|---|
| 105 |       end
 | 
|---|
| 106 |       else
 | 
|---|
| 107 |       begin
 | 
|---|
| 108 |         cboExamResults.Text := '';
 | 
|---|
| 109 |       end;
 | 
|---|
| 110 |     finally
 | 
|---|
| 111 |       EndUpdate;
 | 
|---|
| 112 |     end;
 | 
|---|
| 113 |   end;
 | 
|---|
| 114 | end;
 | 
|---|
| 115 | 
 | 
|---|
| 116 | initialization
 | 
|---|
| 117 |   SpecifyFormIsNotADialog(TfrmExams);
 | 
|---|
| 118 | 
 | 
|---|
| 119 | end.
 | 
|---|
| 120 | 
 | 
|---|