| 1 | //kt -- Modified with SourceScanner on 8/8/2007
|
|---|
| 2 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 3 | //Name: fPCEBase.pas, fPCEBase.dfm
|
|---|
| 4 | //Created: Jan 1999
|
|---|
| 5 | //By: Robert Bott
|
|---|
| 6 | //Location: ISL
|
|---|
| 7 | //Description: Parent form for all PCE tabs. This form will hold methods that are
|
|---|
| 8 | // universal for a PCE tabs. These forms will be child forms to fEncounterFrame.
|
|---|
| 9 | ////////////////////////////////////////////////////////////////////////////////}
|
|---|
| 10 |
|
|---|
| 11 | unit fPCEBase;
|
|---|
| 12 |
|
|---|
| 13 | {$OPTIMIZATION OFF} // REMOVE AFTER UNIT IS DEBUGGED
|
|---|
| 14 |
|
|---|
| 15 | interface
|
|---|
| 16 |
|
|---|
| 17 | uses
|
|---|
| 18 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, uConst,
|
|---|
| 19 | StdCtrls, fAutoSz, Buttons, ORCtrls, ORFn, uPCE, ORDtTm, Checklst,
|
|---|
| 20 | ComCtrls, DKLang;
|
|---|
| 21 |
|
|---|
| 22 | type
|
|---|
| 23 | TfrmPCEBase = class(TfrmAutoSz)
|
|---|
| 24 | btnOK: TBitBtn;
|
|---|
| 25 | btnCancel: TBitBtn;
|
|---|
| 26 | DKLanguageController2: TDKLanguageController;
|
|---|
| 27 | procedure FormCreate(Sender: TObject);
|
|---|
| 28 | procedure btnCancelClick(Sender: TObject);
|
|---|
| 29 | procedure btnOKClick(Sender: TObject); virtual;
|
|---|
| 30 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|---|
| 31 | procedure FormShow(Sender: TObject);
|
|---|
| 32 | private
|
|---|
| 33 | FDisplayCount: Integer; // number of times page displayed
|
|---|
| 34 | FPatientCount: Integer; // number of times page displayed for given pt
|
|---|
| 35 | FCallingContext: Integer;
|
|---|
| 36 | // function GetInitPage: Boolean;
|
|---|
| 37 | // function GetInitPatient: Boolean;
|
|---|
| 38 | // function GetPatientViewed: Boolean;
|
|---|
| 39 | procedure UMResizePage(var Message: TMessage); message UM_RESIZEPAGE;
|
|---|
| 40 | protected
|
|---|
| 41 | FClosing: boolean;
|
|---|
| 42 | FSectionTabs: array[0..2] of Integer;
|
|---|
| 43 | FSectionTabCount: integer;
|
|---|
| 44 | FTabName: string;
|
|---|
| 45 | // procedure CreateParams(var Params: TCreateParams); override;
|
|---|
| 46 | function ActiveCtrl: TWinControl;
|
|---|
| 47 | function SectionString: string;
|
|---|
| 48 | procedure DoEnter; override;
|
|---|
| 49 | public
|
|---|
| 50 | constructor CreateLinked(AParent: TWinControl);
|
|---|
| 51 | procedure Loaded; override;
|
|---|
| 52 | // function AllowContextChange: Boolean; virtual;
|
|---|
| 53 | // procedure ClearPtData; virtual;
|
|---|
| 54 | procedure DisplayPage; virtual;
|
|---|
| 55 | // procedure NotifyOrder(OrderAction: Integer; AnOrder: TOrder); virtual; //*no ordering will be done*//
|
|---|
| 56 | // procedure RequestPrint; virtual;
|
|---|
| 57 | procedure SetFontSize(NewFontSize: Integer); virtual;
|
|---|
| 58 | procedure AllowTabChange(var AllowChange: boolean); virtual;
|
|---|
| 59 |
|
|---|
| 60 | property CallingContext: Integer read FCallingContext;
|
|---|
| 61 | // property InitPage: Boolean read GetInitPage;
|
|---|
| 62 | // property InitPatient: Boolean read GetInitPatient;
|
|---|
| 63 | // property PatientViewed: Boolean read GetPatientViewed;
|
|---|
| 64 | procedure FocusFirstControl;
|
|---|
| 65 | end;
|
|---|
| 66 |
|
|---|
| 67 | var
|
|---|
| 68 | frmPCEBase: TfrmPCEBase;
|
|---|
| 69 |
|
|---|
| 70 | implementation
|
|---|
| 71 |
|
|---|
| 72 | {$R *.DFM}
|
|---|
| 73 |
|
|---|
| 74 | uses
|
|---|
| 75 | fEncounterFrame;
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 79 | //Name: procedure TfrmPCEBase.FormCreate(Sender: TObject);
|
|---|
| 80 | //Created: Jan 1999
|
|---|
| 81 | //By: Robert Bott
|
|---|
| 82 | //Location: ISL
|
|---|
| 83 | //Description: Initialize counters to zero
|
|---|
| 84 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 85 | procedure TfrmPCEBase.FormCreate(Sender: TObject);
|
|---|
| 86 | begin
|
|---|
| 87 | FDisplayCount := 0;
|
|---|
| 88 | FPatientCount := 0;
|
|---|
| 89 | end;
|
|---|
| 90 |
|
|---|
| 91 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 92 | //Name: procedure TfrmPCEBase.CreateParams(var Params: TCreateParams);
|
|---|
| 93 | //Created: Jan 1999
|
|---|
| 94 | //By: Robert Bott
|
|---|
| 95 | //Location: ISL
|
|---|
| 96 | //Description: turn the form into a child window
|
|---|
| 97 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 98 | (*procedure TfrmPCEBase.CreateParams(var Params: TCreateParams);
|
|---|
| 99 | { turn the form into a child window }
|
|---|
| 100 | begin
|
|---|
| 101 | inherited CreateParams(Params);
|
|---|
| 102 | with Params do
|
|---|
| 103 | begin
|
|---|
| 104 | if Owner is TPanel
|
|---|
| 105 | then WndParent := TPanel(Owner).Handle
|
|---|
| 106 | else if owner is TForm then
|
|---|
| 107 | WndParent := (Owner as TForm).Handle;
|
|---|
| 108 | Style := WS_CHILD or WS_CLIPSIBLINGS;
|
|---|
| 109 | X := 0; Y := 0;
|
|---|
| 110 | end;
|
|---|
| 111 | end;
|
|---|
| 112 | *)
|
|---|
| 113 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 114 | //Name: procedure TfrmPCEBase.Loaded;
|
|---|
| 115 | //Created: Jan 1999
|
|---|
| 116 | //By: Robert Bott
|
|---|
| 117 | //Location: ISL
|
|---|
| 118 | //Description: make the form borderless to allow it to be a child window
|
|---|
| 119 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 120 | procedure TfrmPCEBase.Loaded;
|
|---|
| 121 | begin
|
|---|
| 122 | inherited Loaded;
|
|---|
| 123 | Visible := False;
|
|---|
| 124 | Position := poDefault;
|
|---|
| 125 | BorderIcons := [];
|
|---|
| 126 | BorderStyle := bsNone;
|
|---|
| 127 | HandleNeeded;
|
|---|
| 128 | SetBounds(0, 0, Width, Height);
|
|---|
| 129 | end;
|
|---|
| 130 |
|
|---|
| 131 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 132 | //Name: function TfrmPCEBase.AllowContextChange: Boolean;
|
|---|
| 133 | //Created: Jan 1999
|
|---|
| 134 | //By: Robert Bott
|
|---|
| 135 | //Location: ISL
|
|---|
| 136 | //Description:
|
|---|
| 137 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 138 | (*function TfrmPCEBase.AllowContextChange: Boolean;
|
|---|
| 139 | begin
|
|---|
| 140 | Result := True;
|
|---|
| 141 | end;
|
|---|
| 142 |
|
|---|
| 143 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 144 | //Name: procedure TfrmPCEBase.ClearPtData;
|
|---|
| 145 | //Created: Jan 1999
|
|---|
| 146 | //By: Robert Bott
|
|---|
| 147 | //Location: ISL
|
|---|
| 148 | //Description: clear all patient related data on a page
|
|---|
| 149 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 150 | procedure TfrmPCEBase.ClearPtData;
|
|---|
| 151 | begin
|
|---|
| 152 | FPatientCount := 0;
|
|---|
| 153 | end;
|
|---|
| 154 | *)
|
|---|
| 155 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 156 | //Name: procedure TfrmPCEBase.DisplayPage;
|
|---|
| 157 | //Created: Jan 1999
|
|---|
| 158 | //By: Robert Bott
|
|---|
| 159 | //Location: ISL
|
|---|
| 160 | //Description: cause the page to be displayed and update the display counters
|
|---|
| 161 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 162 | procedure TfrmPCEBase.DisplayPage;
|
|---|
| 163 | begin
|
|---|
| 164 | BringToFront;
|
|---|
| 165 | // FocusControl(ActiveCtrl);
|
|---|
| 166 | //SetFocus;
|
|---|
| 167 | Inc(FDisplayCount);
|
|---|
| 168 | Inc(FPatientCount);
|
|---|
| 169 | FCallingContext := frmEncounterFrame.ChangeSource;
|
|---|
| 170 | if (FCallingContext = CC_CLICK) and (FPatientCount = 1)
|
|---|
| 171 | then FCallingContext := CC_INIT_PATIENT;
|
|---|
| 172 | end;
|
|---|
| 173 | (*
|
|---|
| 174 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 175 | //Name: procedure TfrmPCEBase.RequestPrint;
|
|---|
| 176 | //Created: Jan 1999
|
|---|
| 177 | //By: Robert Bott
|
|---|
| 178 | //Location: ISL
|
|---|
| 179 | //Description: For posible future use when printing is supported.
|
|---|
| 180 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 181 | procedure TfrmPCEBase.RequestPrint;
|
|---|
| 182 | begin
|
|---|
| 183 | //
|
|---|
| 184 | end;
|
|---|
| 185 | *)
|
|---|
| 186 |
|
|---|
| 187 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 188 | //Name: procedure TfrmPCEBase.SetFontSize(NewFontSize: Integer);
|
|---|
| 189 | //Created: Jan 1999
|
|---|
| 190 | //By: Robert Bott
|
|---|
| 191 | //Location: ISL
|
|---|
| 192 | //Description: Assign the new font size.
|
|---|
| 193 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 194 | procedure TfrmPCEBase.SetFontSize(NewFontSize: Integer);
|
|---|
| 195 | begin
|
|---|
| 196 | Font.Size := NewFontSize;
|
|---|
| 197 | end;
|
|---|
| 198 | (*
|
|---|
| 199 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 200 | //Name: function TfrmPCEBase.GetInitPage: Boolean;
|
|---|
| 201 | //Created: Jan 1999
|
|---|
| 202 | //By: Robert Bott
|
|---|
| 203 | //Location: ISL
|
|---|
| 204 | //Description: if the count is one, this is the first time the page is being displayed.
|
|---|
| 205 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 206 | function TfrmPCEBase.GetInitPage: Boolean;
|
|---|
| 207 | begin
|
|---|
| 208 | Result := FDisplayCount = 1;
|
|---|
| 209 | end;
|
|---|
| 210 |
|
|---|
| 211 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 212 | //Name: function TfrmPCEBase.GetInitPatient: Boolean;
|
|---|
| 213 | //Created: Jan 1999
|
|---|
| 214 | //By: Robert Bott
|
|---|
| 215 | //Location: ISL
|
|---|
| 216 | //Description: if the count is one, this is the first time the page is being
|
|---|
| 217 | // displayed for a given patient
|
|---|
| 218 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 219 | function TfrmPCEBase.GetInitPatient: Boolean;
|
|---|
| 220 | begin
|
|---|
| 221 | Result := FPatientCount = 1;
|
|---|
| 222 | end;
|
|---|
| 223 |
|
|---|
| 224 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 225 | //Name: function TfrmPCEBase.GetPatientViewed: Boolean;
|
|---|
| 226 | //Created: Jan 1999
|
|---|
| 227 | //By: Robert Bott
|
|---|
| 228 | //Location: ISL
|
|---|
| 229 | //Description: returns false if the tab has never been clicked for this patient
|
|---|
| 230 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 231 | function TfrmPCEBase.GetPatientViewed: Boolean;
|
|---|
| 232 | begin
|
|---|
| 233 | Result := FPatientCount > 0;
|
|---|
| 234 | end;
|
|---|
| 235 | *)
|
|---|
| 236 | (*
|
|---|
| 237 | procedure RepaintControl(AControl: TControl);
|
|---|
| 238 | var
|
|---|
| 239 | i: Integer;
|
|---|
| 240 | begin
|
|---|
| 241 | AControl.Invalidate;
|
|---|
| 242 | AControl.Update;
|
|---|
| 243 | if AControl is TWinControl then with TWinControl(AControl) do
|
|---|
| 244 | for i := 0 to ControlCount - 1 do RepaintControl(Controls[i]);
|
|---|
| 245 | end;
|
|---|
| 246 | *)
|
|---|
| 247 |
|
|---|
| 248 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 249 | //Name: procedure TfrmPCEBase.UMResizePage(var Message: TMessage);
|
|---|
| 250 | //Created: Jan 1999
|
|---|
| 251 | //By: Robert Bott
|
|---|
| 252 | //Location: ISL
|
|---|
| 253 | //Description: Redraw the controls on the form when it is resized.
|
|---|
| 254 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 255 | procedure TfrmPCEBase.UMResizePage(var Message: TMessage);
|
|---|
| 256 | var
|
|---|
| 257 | i: Integer;
|
|---|
| 258 | begin
|
|---|
| 259 | for i := 0 to ComponentCount - 1 do
|
|---|
| 260 | if Components[i] is TControl then with TControl(Components[i]) do Invalidate;
|
|---|
| 261 | Update;
|
|---|
| 262 | end;
|
|---|
| 263 |
|
|---|
| 264 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 265 | //Name: procedure TfrmPCEBase.btnCancelClick(Sender: TObject);
|
|---|
| 266 | //Created: Jan 1999
|
|---|
| 267 | //By: Robert Bott
|
|---|
| 268 | //Location: ISL
|
|---|
| 269 | //Description: Indicate to the frame that cancel was pressed, and close the frame.
|
|---|
| 270 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 271 | procedure TfrmPCEBase.btnCancelClick(Sender: TObject);
|
|---|
| 272 | begin
|
|---|
| 273 | inherited;
|
|---|
| 274 | frmencounterframe.Abort := FALSE;
|
|---|
| 275 | frmEncounterFrame.Cancel := true;
|
|---|
| 276 | frmencounterframe.Close;
|
|---|
| 277 | end;
|
|---|
| 278 |
|
|---|
| 279 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 280 | //Name: procedure TfrmPCEBase.btnCancelClick(Sender: TObject);
|
|---|
| 281 | //Created: Jan 1999
|
|---|
| 282 | //By: Robert Bott
|
|---|
| 283 | //Location: ISL
|
|---|
| 284 | //Description: Indicate to the frame that it should close and save data.
|
|---|
| 285 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 286 | procedure TfrmPCEBase.btnOKClick(Sender: TObject);
|
|---|
| 287 | begin
|
|---|
| 288 | frmencounterframe.Abort := FALSE;
|
|---|
| 289 | frmencounterframe.Close;
|
|---|
| 290 | end;
|
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 294 | //Name: procedure TfrmPCEBase.FormClose(Sender: TObject; var Action: TCloseAction);
|
|---|
| 295 | //Created: Jan 1999
|
|---|
| 296 | //By: Robert Bott
|
|---|
| 297 | //Location: ISL
|
|---|
| 298 | //Description: Free the memory held by the form.
|
|---|
| 299 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 300 | procedure TfrmPCEBase.FormClose(Sender: TObject; var Action: TCloseAction);
|
|---|
| 301 | begin
|
|---|
| 302 | inherited;
|
|---|
| 303 | action := caFree; //destroy the forms when closed
|
|---|
| 304 | FClosing := TRUE;
|
|---|
| 305 | end;
|
|---|
| 306 |
|
|---|
| 307 | {///////////////////////////////////////////////////////////////////////////////
|
|---|
| 308 | //Name: procedure TfrmPCEBase.CheckListDrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
|
|---|
| 309 | // State: TOwnerDrawState);
|
|---|
| 310 | //Created: Jan 1999
|
|---|
| 311 | //By: Robert Bott
|
|---|
| 312 | //Location: ISL
|
|---|
| 313 | //Description: Populate the checklist
|
|---|
| 314 | ///////////////////////////////////////////////////////////////////////////////}
|
|---|
| 315 | procedure TfrmPCEBase.AllowTabChange(var AllowChange: boolean);
|
|---|
| 316 | begin
|
|---|
| 317 | end;
|
|---|
| 318 |
|
|---|
| 319 | constructor TfrmPCEBase.CreateLinked(AParent: TWinControl);
|
|---|
| 320 | begin
|
|---|
| 321 | inherited Create(GetParentForm(AParent));
|
|---|
| 322 | Parent := AParent;
|
|---|
| 323 | Align := alClient;
|
|---|
| 324 | Show;
|
|---|
| 325 | end;
|
|---|
| 326 |
|
|---|
| 327 | function TfrmPCEBase.ActiveCtrl: TWinControl;
|
|---|
| 328 | begin
|
|---|
| 329 | Result := GetParentForm(Self).ActiveControl;
|
|---|
| 330 | if(Result is TORComboEdit) then
|
|---|
| 331 | Result := TWinControl(Result.Owner);
|
|---|
| 332 | end;
|
|---|
| 333 |
|
|---|
| 334 | function TfrmPCEBase.SectionString: string;
|
|---|
| 335 | var
|
|---|
| 336 | v, i: integer;
|
|---|
| 337 |
|
|---|
| 338 | begin
|
|---|
| 339 | Result := '';
|
|---|
| 340 | if FSectionTabCount = 0 then exit;
|
|---|
| 341 | v := 0;
|
|---|
| 342 | for i := 0 to FSectionTabCount-1 do
|
|---|
| 343 | begin
|
|---|
| 344 | if(Result <> '') then
|
|---|
| 345 | Result := Result + ',';
|
|---|
| 346 | Result := Result + IntToStr(FSectionTabs[i]);
|
|---|
| 347 | v := FSectionTabs[i];
|
|---|
| 348 | end;
|
|---|
| 349 | for i := 1 to 20 do
|
|---|
| 350 | begin
|
|---|
| 351 | if(v<0) then
|
|---|
| 352 | dec(v,32)
|
|---|
| 353 | else
|
|---|
| 354 | inc(v,32);
|
|---|
| 355 | if Result <> '' then Result := Result + ',';
|
|---|
| 356 | Result := Result + inttostr(v);
|
|---|
| 357 | end;
|
|---|
| 358 | end;
|
|---|
| 359 |
|
|---|
| 360 | procedure TfrmPCEBase.DoEnter;
|
|---|
| 361 | begin
|
|---|
| 362 | inherited;
|
|---|
| 363 | frmEncounterFrame.SelectTab(FTabName);
|
|---|
| 364 | end;
|
|---|
| 365 |
|
|---|
| 366 | procedure TfrmPCEBase.FocusFirstControl;
|
|---|
| 367 | begin
|
|---|
| 368 | // SetFocus;
|
|---|
| 369 | FindNextControl(self, True, True, False).SetFocus;
|
|---|
| 370 | end;
|
|---|
| 371 |
|
|---|
| 372 | procedure TfrmPCEBase.FormShow(Sender: TObject);
|
|---|
| 373 | begin
|
|---|
| 374 | inherited;
|
|---|
| 375 | FocusFirstControl;
|
|---|
| 376 | end;
|
|---|
| 377 |
|
|---|
| 378 | end.
|
|---|