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