| [453] | 1 | //kt -- Modified with SourceScanner on 8/8/2007 | 
|---|
|  | 2 | unit fODLabOthCollSamp; | 
|---|
|  | 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 | TfrmODLabOthCollSamp = class(TForm) | 
|---|
|  | 12 | pnlBase: TORAutoPanel; | 
|---|
|  | 13 | cboOtherCollSamp: TORComboBox; | 
|---|
|  | 14 | cmdOK: TButton; | 
|---|
|  | 15 | cmdCancel: TButton; | 
|---|
|  | 16 | DKLanguageController1: TDKLanguageController; | 
|---|
|  | 17 | procedure cmdCancelClick(Sender: TObject); | 
|---|
|  | 18 | procedure cmdOKClick(Sender: TObject); | 
|---|
|  | 19 | procedure cboOtherCollSampDblClick(Sender: TObject); | 
|---|
|  | 20 | private | 
|---|
|  | 21 | FOtherCollSamp: string; | 
|---|
|  | 22 | end; | 
|---|
|  | 23 |  | 
|---|
|  | 24 | function SelectOtherCollSample(FontSize: Integer; Skip: integer; CollSampList: TList): string ; | 
|---|
|  | 25 |  | 
|---|
|  | 26 | implementation | 
|---|
|  | 27 |  | 
|---|
|  | 28 | {$R *.DFM} | 
|---|
|  | 29 |  | 
|---|
|  | 30 | uses fODLab, rODLab; | 
|---|
|  | 31 |  | 
|---|
|  | 32 | //const | 
|---|
|  | 33 | //TX_NOCOLLSAMP_TEXT = 'Select a collection sample or press Cancel.';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 34 | //TX_NOCOLLSAMP_CAP = 'Missing Collection Sample';  <-- original line.  //kt 8/8/2007 | 
|---|
|  | 35 |  | 
|---|
|  | 36 | var | 
|---|
|  | 37 | TX_NOCOLLSAMP_TEXT  : string;  //kt | 
|---|
|  | 38 | TX_NOCOLLSAMP_CAP   : string;  //kt | 
|---|
|  | 39 |  | 
|---|
|  | 40 |  | 
|---|
|  | 41 | procedure SetupVars; | 
|---|
|  | 42 | //kt Added entire function to replace constant declarations 8/8/2007 | 
|---|
|  | 43 | begin | 
|---|
|  | 44 | TX_NOCOLLSAMP_TEXT := DKLangConstW('fODLabOthCollSamp_Select_a_collection_sample_or_press_Cancelx'); | 
|---|
|  | 45 | TX_NOCOLLSAMP_CAP := DKLangConstW('fODLabOthCollSamp_Missing_Collection_Sample'); | 
|---|
|  | 46 | end; | 
|---|
|  | 47 |  | 
|---|
|  | 48 | function SelectOtherCollSample(FontSize: Integer; Skip: integer; CollSampList: TList): string ; | 
|---|
|  | 49 | { displays collection sample select form for lab and returns a record of the selection } | 
|---|
|  | 50 | var | 
|---|
|  | 51 | frmODLabOthCollSamp: TfrmODLabOthCollSamp; | 
|---|
|  | 52 | W, H, i: Integer; | 
|---|
|  | 53 | x: string; | 
|---|
|  | 54 | begin | 
|---|
|  | 55 | frmODLabOthCollSamp := TfrmODLabOthCollSamp.Create(Application); | 
|---|
|  | 56 | try | 
|---|
|  | 57 | with frmODLabOthCollSamp do | 
|---|
|  | 58 | begin | 
|---|
|  | 59 | Font.Size := FontSize; | 
|---|
|  | 60 | W := ClientWidth; | 
|---|
|  | 61 | H := ClientHeight; | 
|---|
|  | 62 | ResizeToFont(FontSize, W, H); | 
|---|
|  | 63 | ClientWidth  := W; pnlBase.Width  := W; | 
|---|
|  | 64 | ClientHeight := H; pnlBase.Height := H; | 
|---|
|  | 65 | with CollSampList do for i := Skip to Count-1 do with TCollSamp(Items[i]) do | 
|---|
|  | 66 | begin | 
|---|
|  | 67 | x := IntToStr(CollSampID) + '^' + CollSampName; | 
|---|
|  | 68 | if Length(TubeColor) <> 0 then x := x + ' (' + TubeColor + ')'; | 
|---|
|  | 69 | cboOtherCollSamp.Items.Add(x) ; | 
|---|
|  | 70 | end; | 
|---|
|  | 71 | ShowModal; | 
|---|
|  | 72 | Result := FOtherCollSamp; | 
|---|
|  | 73 | end; | 
|---|
|  | 74 | finally | 
|---|
|  | 75 | frmODLabOthCollSamp.Release; | 
|---|
|  | 76 | end; | 
|---|
|  | 77 | end; | 
|---|
|  | 78 |  | 
|---|
|  | 79 | procedure TfrmODLabOthCollSamp.cmdCancelClick(Sender: TObject); | 
|---|
|  | 80 | begin | 
|---|
|  | 81 | FOtherCollSamp := '-1'  ; | 
|---|
|  | 82 | Close; | 
|---|
|  | 83 | end; | 
|---|
|  | 84 |  | 
|---|
|  | 85 | procedure TfrmODLabOthCollSamp.cmdOKClick(Sender: TObject); | 
|---|
|  | 86 | begin | 
|---|
|  | 87 | SetupVars;  //kt added 8/8/2007 to replace constants with vars. | 
|---|
|  | 88 | if cboOtherCollSamp.ItemIEN = 0 then | 
|---|
|  | 89 | begin | 
|---|
|  | 90 | InfoBox(TX_NOCOLLSAMP_TEXT, TX_NOCOLLSAMP_CAP, MB_OK or MB_ICONWARNING); | 
|---|
|  | 91 | Exit; | 
|---|
|  | 92 | end; | 
|---|
|  | 93 | if cboOtherCollSamp.ItemIEN > 0 then | 
|---|
|  | 94 | FOtherCollSamp := cboOtherCollSamp.Items[cboOtherCollSamp.ItemIndex] | 
|---|
|  | 95 | else | 
|---|
|  | 96 | FOtherCollSamp := '-1'  ; | 
|---|
|  | 97 | Close; | 
|---|
|  | 98 | end; | 
|---|
|  | 99 |  | 
|---|
|  | 100 | procedure TfrmODLabOthCollSamp.cboOtherCollSampDblClick(Sender: TObject); | 
|---|
|  | 101 | begin | 
|---|
|  | 102 | cmdOKClick(Self); | 
|---|
|  | 103 | end; | 
|---|
|  | 104 |  | 
|---|
|  | 105 | end. | 
|---|