[459] | 1 | unit fHealthFactor;
|
---|
| 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;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 11 | TfrmHealthFactors = class(TfrmPCEBaseMain)
|
---|
| 12 | lblHealthLevel: TLabel;
|
---|
| 13 | cboHealthLevel: TORComboBox;
|
---|
| 14 |
|
---|
| 15 | procedure cboHealthLevelChange(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 | frmHealthFactors: TfrmHealthFactors;
|
---|
| 26 |
|
---|
| 27 | implementation
|
---|
| 28 |
|
---|
| 29 | {$R *.DFM}
|
---|
| 30 |
|
---|
| 31 | uses
|
---|
| 32 | fEncounterFrame;
|
---|
| 33 |
|
---|
| 34 | procedure tfrmHealthFactors.cboHealthLevelChange(Sender: TObject);
|
---|
| 35 | var
|
---|
| 36 | i: integer;
|
---|
| 37 |
|
---|
| 38 | begin
|
---|
| 39 | if(NotUpdating) and (cboHealthLevel.Text <> '') then
|
---|
| 40 | begin
|
---|
| 41 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 42 | if(lbGrid.Selected[i]) then
|
---|
| 43 | TPCEPat(lbGrid.Items.Objects[i]).Level := cboHealthLevel.ItemID;
|
---|
| 44 | GridChanged;
|
---|
| 45 | end;
|
---|
| 46 | end;
|
---|
| 47 |
|
---|
| 48 | procedure TfrmHealthFactors.FormCreate(Sender: TObject);
|
---|
| 49 | begin
|
---|
| 50 | inherited;
|
---|
| 51 | FTabName := CT_HlthNm;
|
---|
| 52 | FPCEListCodesProc := ListHealthCodes;
|
---|
| 53 | FPCEItemClass := TPCEHealth;
|
---|
| 54 | FPCECode := 'HF';
|
---|
| 55 | PCELoadORCombo(cboHealthLevel);
|
---|
| 56 | end;
|
---|
| 57 |
|
---|
| 58 | procedure TfrmHealthFactors.UpdateNewItemStr(var x: string);
|
---|
| 59 | begin
|
---|
| 60 | SetPiece(x, U, pnumHFLevel, NoPCEValue);
|
---|
| 61 | end;
|
---|
| 62 |
|
---|
| 63 | procedure TfrmHealthFactors.UpdateControls;
|
---|
| 64 | var
|
---|
| 65 | ok, First: boolean;
|
---|
| 66 | SameHL: boolean;
|
---|
| 67 | i: integer;
|
---|
| 68 | HL: string;
|
---|
| 69 | Obj: TPCEHealth;
|
---|
| 70 |
|
---|
| 71 | begin
|
---|
| 72 | inherited;
|
---|
| 73 | if(NotUpdating) then
|
---|
| 74 | begin
|
---|
| 75 | BeginUpdate;
|
---|
| 76 | try
|
---|
| 77 | ok := (lbGrid.SelCount > 0);
|
---|
| 78 | lblHealthLevel.Enabled := ok;
|
---|
| 79 | cboHealthLevel.Enabled := ok;
|
---|
| 80 | if(ok) then
|
---|
| 81 | begin
|
---|
| 82 | First := TRUE;
|
---|
| 83 | SameHL := TRUE;
|
---|
| 84 | HL := NoPCEValue;
|
---|
| 85 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 86 | begin
|
---|
| 87 | if lbGrid.Selected[i] then
|
---|
| 88 | begin
|
---|
| 89 | Obj := TPCEHealth(lbGrid.Items.Objects[i]);
|
---|
| 90 | if(First) then
|
---|
| 91 | begin
|
---|
| 92 | First := FALSE;
|
---|
| 93 | HL := Obj.Level;
|
---|
| 94 | end
|
---|
| 95 | else
|
---|
| 96 | begin
|
---|
| 97 | if(SameHL) then
|
---|
| 98 | SameHL := (HL = Obj.Level);
|
---|
| 99 | end;
|
---|
| 100 | end;
|
---|
| 101 | end;
|
---|
| 102 | if(SameHL) then
|
---|
| 103 | cboHealthLevel.SelectByID(HL)
|
---|
| 104 | else
|
---|
| 105 | cboHealthLevel.Text := '';
|
---|
| 106 | end
|
---|
| 107 | else
|
---|
| 108 | begin
|
---|
| 109 | cboHealthLevel.Text := '';
|
---|
| 110 | end;
|
---|
| 111 | finally
|
---|
| 112 | EndUpdate;
|
---|
| 113 | end;
|
---|
| 114 | end;
|
---|
| 115 | end;
|
---|
| 116 |
|
---|
| 117 | end.
|
---|