| [453] | 1 | //kt -- Modified with SourceScanner on 8/8/2007
 | 
|---|
 | 2 | unit fODLabOthSpec;
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | interface
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | uses
 | 
|---|
 | 7 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
 | 8 |   ExtCtrls, ORCtrls, StdCtrls, ORFn, DKLang;
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | type
 | 
|---|
 | 11 |   TfrmODLabOthSpec = class(TForm)
 | 
|---|
 | 12 |     pnlBase: TORAutoPanel;
 | 
|---|
 | 13 |     cboOtherSpec: TORComboBox;
 | 
|---|
 | 14 |     cmdOK: TButton;
 | 
|---|
 | 15 |     cmdCancel: TButton;
 | 
|---|
 | 16 |     DKLanguageController1: TDKLanguageController;
 | 
|---|
 | 17 |     procedure cmdCancelClick(Sender: TObject);
 | 
|---|
 | 18 |     procedure cmdOKClick(Sender: TObject);
 | 
|---|
 | 19 |     procedure cboOtherSpecDblClick(Sender: TObject);
 | 
|---|
 | 20 |     procedure cboOtherSpecNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 21 |       Direction, InsertAt: Integer);
 | 
|---|
 | 22 |   private
 | 
|---|
 | 23 |     FOtherSpec: string;
 | 
|---|
 | 24 |   end;
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 | function SelectOtherSpecimen(FontSize: Integer; SpecimenList: TStringList): string ;
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | implementation
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | {$R *.DFM}
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | uses fODLab, rODLab;
 | 
|---|
 | 33 | 
 | 
|---|
 | 34 | //const
 | 
|---|
 | 35 | //TX_NOSPEC_TEXT = 'Select a specimen or press Cancel.';  <-- original line.  //kt 8/8/2007
 | 
|---|
 | 36 | //TX_NOSPEC_CAP = 'Missing Specimen';  <-- original line.  //kt 8/8/2007
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | var
 | 
|---|
 | 39 |   TX_NOSPEC_TEXT  : string;  //kt
 | 
|---|
 | 40 |   TX_NOSPEC_CAP   : string;  //kt
 | 
|---|
 | 41 | 
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 | procedure SetupVars;
 | 
|---|
 | 44 | //kt Added entire function to replace constant declarations 8/8/2007
 | 
|---|
 | 45 | begin
 | 
|---|
 | 46 |   TX_NOSPEC_TEXT := DKLangConstW('fODLabOthSpec_Select_a_specimen_or_press_Cancelx');
 | 
|---|
 | 47 |   TX_NOSPEC_CAP := DKLangConstW('fODLabOthSpec_Missing_Specimen');
 | 
|---|
 | 48 | end;
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 | function SelectOtherSpecimen(FontSize: Integer; SpecimenList: TStringList): string ;
 | 
|---|
 | 51 | { displays collection sample select form for lab and returns a record of the selection }
 | 
|---|
 | 52 | var
 | 
|---|
 | 53 |   frmODLabOthSpec: TfrmODLabOthSpec;
 | 
|---|
 | 54 |   W, H: Integer;
 | 
|---|
 | 55 | begin
 | 
|---|
 | 56 |   frmODLabOthSpec := TfrmODLabOthSpec.Create(Application);
 | 
|---|
 | 57 |   try
 | 
|---|
 | 58 |     with frmODLabOthSpec do
 | 
|---|
 | 59 |     begin
 | 
|---|
 | 60 |       Font.Size := FontSize;
 | 
|---|
 | 61 |       W := ClientWidth;
 | 
|---|
 | 62 |       H := ClientHeight;
 | 
|---|
 | 63 |       ResizeToFont(FontSize, W, H);
 | 
|---|
 | 64 |       ClientWidth  := W; pnlBase.Width  := W;
 | 
|---|
 | 65 |       ClientHeight := H; pnlBase.Height := H;
 | 
|---|
 | 66 |       with cboOtherSpec do
 | 
|---|
 | 67 |         begin
 | 
|---|
 | 68 |           {MItems.Assign(SpecimenList);
 | 
|---|
 | 69 |           InsertSeparator; }
 | 
|---|
 | 70 |           InitLongList('');
 | 
|---|
 | 71 |         end;
 | 
|---|
 | 72 |       ShowModal;
 | 
|---|
 | 73 |       Result := FOtherSpec;
 | 
|---|
 | 74 |     end;
 | 
|---|
 | 75 |   finally
 | 
|---|
 | 76 |     frmODLabOthSpec.Release;
 | 
|---|
 | 77 |   end;
 | 
|---|
 | 78 | end;
 | 
|---|
 | 79 | 
 | 
|---|
 | 80 | procedure TfrmODLabOthSpec.cmdCancelClick(Sender: TObject);
 | 
|---|
 | 81 | begin
 | 
|---|
 | 82 |   FOtherSpec := '-1'  ;
 | 
|---|
 | 83 |   Close;
 | 
|---|
 | 84 | end;
 | 
|---|
 | 85 | 
 | 
|---|
 | 86 | procedure TfrmODLabOthSpec.cmdOKClick(Sender: TObject);
 | 
|---|
 | 87 | begin
 | 
|---|
 | 88 |   SetupVars;  //kt added 8/8/2007 to replace constants with vars.
 | 
|---|
 | 89 |   if cboOtherSpec.ItemIEN = 0 then
 | 
|---|
 | 90 |    begin
 | 
|---|
 | 91 |     InfoBox(TX_NOSPEC_TEXT, TX_NOSPEC_CAP, MB_OK or MB_ICONWARNING);
 | 
|---|
 | 92 |     Exit;
 | 
|---|
 | 93 |    end;
 | 
|---|
 | 94 |   if cboOtherSpec.ItemIEN > 0 then
 | 
|---|
 | 95 |      FOtherSpec := cboOtherSpec.Items[cboOtherSpec.ItemIndex]
 | 
|---|
 | 96 |   else
 | 
|---|
 | 97 |      FOtherSpec := '-1'  ;
 | 
|---|
 | 98 |   Close;
 | 
|---|
 | 99 | end;
 | 
|---|
 | 100 | 
 | 
|---|
 | 101 | procedure TfrmODLabOthSpec.cboOtherSpecDblClick(Sender: TObject);
 | 
|---|
 | 102 | begin
 | 
|---|
 | 103 |   cmdOKClick(Self);
 | 
|---|
 | 104 | end;
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | procedure TfrmODLabOthSpec.cboOtherSpecNeedData(Sender: TObject;
 | 
|---|
 | 107 |   const StartFrom: string; Direction, InsertAt: Integer);
 | 
|---|
 | 108 | begin
 | 
|---|
 | 109 |   inherited;
 | 
|---|
 | 110 |   cboOtherSpec.ForDataUse(SubsetOfSpecimens(StartFrom, Direction));
 | 
|---|
 | 111 | end;
 | 
|---|
 | 112 | 
 | 
|---|
 | 113 | end.
 | 
|---|