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