close Warning: Can't use blame annotator:
svn blame failed on cprs/branches/tmg-cprs/CPRS-Chart/fDeviceSelect.pas: 'GenericSWIGWrapper' object has no attribute '_wrap'

source: cprs/branches/tmg-cprs/CPRS-Chart/fDeviceSelect.pas@ 738

Last change on this file since 738 was 453, checked in by Kevin Toppenberg, 16 years ago

Initial upload of TMG-CPRS 1.0.26.69

File size: 6.2 KB
RevLine 
1//kt -- Modified with SourceScanner on 7/15/2007
2unit fDeviceSelect;
3//kt note: This wasn't in CPRS project. I added it.
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 StdCtrls, fAutoSz, ORCtrls, ORNet, Mask, ExtCtrls;
9
10type
11 TfrmDeviceSelect = class(TfrmAutoSz)
12 grpDevice: TGroupBox;
13 cboDevice: TORComboBox;
14 pnlBottom: TPanel;
15 cmdOK: TButton;
16 cmdCancel: TButton;
17 chkDefault: TCheckBox;
18 pnlGBBottom: TPanel;
19 lblMargin: TLabel;
20 txtRightMargin: TMaskEdit;
21 lblLength: TLabel;
22 txtPageLength: TMaskEdit;
23 procedure cboDeviceChange(Sender: TObject);
24 procedure cmdOKClick(Sender: TObject);
25 procedure cmdCancelClick(Sender: TObject);
26 procedure cboDeviceNeedData(Sender: TObject; const StartFrom: String;
27 Direction, InsertAt: Integer);
28 procedure FormShow(Sender: TObject);
29 procedure FormClose(Sender: TObject; var Action: TCloseAction);
30 private
31 //kt Begin Mod (change Consts to Vars) 7/15/2007
32 TX_NODEVICE : string; //kt
33 TX_NODEVICE_CAP : string; //kt
34 TX_ERR_CAP : string; //kt
35 //kt End Mod -------------------
36 FWinPrint: Boolean;
37 procedure SetupVars; //kt 7-15-07
38 end;
39
40var
41 frmDeviceSelect: TfrmDeviceSelect;
42 ADevice: string;
43
44function SelectDevice(Sender: TObject; ALocation: integer; AllowWindowsPrinter: boolean; ACaption: String): string ;
45
46implementation
47
48{$R *.DFM}
49
50uses ORFn, rCore, uCore, rReports, Printers, fFrame, rMisc,
51 DKLang; //kt 7-15-07
52
53//const
54//TX_NODEVICE = 'A device must be selected to print, or press ''Cancel'' to not print.'; <-- original line. //kt 7/15/2007
55//TX_NODEVICE_CAP = 'Device Not Selected'; <-- original line. //kt 7/15/2007
56//TX_ERR_CAP = 'Print Error'; <-- original line. //kt 7/15/2007
57
58
59procedure TfrmDeviceSelect.SetupVars;
60//kt Added entire function to replace constant declarations 7/15/2007
61begin
62 TX_NODEVICE := DKLangConstW('fDeviceSelect_A_device_must_be_selected_to_print_or_press_Cancel_to_not_print');
63 TX_NODEVICE_CAP := DKLangConstW('fDeviceSelect_Device_Not_Selected');
64 TX_ERR_CAP := DKLangConstW('fDeviceSelect_Print_Error');
65end;
66
67function SelectDevice(Sender: TObject; ALocation: integer; AllowWindowsPrinter: boolean; ACaption: String): string ;
68{ displays a form that prompts for a device}
69var
70 frmDeviceSelect: TfrmDeviceSelect;
71 DefPrt: string;
72begin
73 frmDeviceSelect := TfrmDeviceSelect.Create(Application);
74 try
75 ResizeFormToFont(TForm(frmDeviceSelect));
76 with frmDeviceSelect do
77 begin
78 FWinPrint := AllowWindowsPrinter;
79 with cboDevice do
80 begin
81 if (FWinPrint) and (Printer.Printers.Count > 0) then
82 begin
83// Items.Add('WIN;Windows Printer^Windows Printer'); <-- original line. //kt 7/15/2007
84 Items.Add('WIN;' + DKLangConstW('fDeviceSelect_Windows_Printer')+'^'+DKLangConstW('fDeviceSelect_Windows_Printer')); //kt added 7/15/2007
85// Items.Add('^--------------------VistA Printers----------------------'); <-- original line. //kt 7/15/2007
86 Items.Add('^'+DKLangConstW('fDeviceSelect_VistA_Printers')); //kt added 7/15/2007
87 end;
88 end;
89 if Sender <> frmFrame then
90 begin
91 DefPrt := User.CurrentPrinter;
92 if DefPrt = '' then DefPrt := GetDefaultPrinter(User.Duz, Encounter.Location);
93 if DefPrt <> '' then
94 begin
95 if (not FWinPrint) then
96 begin
97// if (DefPrt <> 'WIN;Windows Printer') then <-- original line. //kt 7/15/2007
98 if (DefPrt <> DKLangConstW('fDeviceSelect_WINWindows_Printer')) then //kt added 7/15/2007
99 begin
100 cboDevice.InitLongList(Piece(DefPrt, ';', 2));
101 cboDevice.SelectByID(DefPrt);
102 end
103 else
104 cboDevice.InitLongList('');
105 end
106 else if FWinprint then
107 begin
108 cboDevice.InitLongList(Piece(DefPrt, ';', 2));
109 cboDevice.SelectByID(DefPrt);
110 end;
111 end
112 else
113 begin
114 cboDevice.InitLongList('');
115 end;
116 if ACaption<>'' then frmDeviceSelect.Caption:=ACaption;
117 end
118 else
119 begin
120// frmDeviceSelect.Caption := 'Print Device Selection'; <-- original line. //kt 7/15/2007
121 frmDeviceSelect.Caption := DKLangConstW('fDeviceSelect_Print_Device_Selection'); //kt added 7/15/2007
122 cboDevice.InitLongList('');
123 end;
124 ShowModal;
125 Result := ADevice;
126 //Result := Piece(ADevice, ';', 1) + U + Piece(ADevice, U, 2);
127 end;
128 finally
129 frmDeviceSelect.Release;
130 end;
131end;
132
133procedure TfrmDeviceSelect.cboDeviceChange(Sender: TObject);
134begin
135inherited;
136 with cboDevice do if ItemIndex > -1 then
137 begin
138 txtRightMargin.Text := Piece(Items[ItemIndex], '^', 4);
139 txtPageLength.Text := Piece(Items[ItemIndex], '^', 5);
140 end;
141end;
142
143procedure TfrmDeviceSelect.cmdOKClick(Sender: TObject);
144begin
145 SetupVars; //kt added 7/15/2007 to replace constants with vars.
146 inherited;
147 if cboDevice.ItemID = '' then
148 begin
149 InfoBox(TX_NODEVICE, TX_NODEVICE_CAP, MB_OK);
150 Exit;
151 end;
152 ADevice := cboDevice.Items[cboDevice.ItemIndex];
153 if chkDefault.Checked then SaveDefaultPrinter(Piece(cboDevice.ItemID, ';', 1));
154 Close;
155end;
156
157procedure TfrmDeviceSelect.cmdCancelClick(Sender: TObject);
158begin
159 inherited;
160 ADevice := '';
161 Close;
162end;
163
164procedure TfrmDeviceSelect.cboDeviceNeedData(Sender: TObject;
165 const StartFrom: String; Direction, InsertAt: Integer);
166begin
167 inherited;
168 cboDevice.ForDataUse(SubsetOfDevices(StartFrom, Direction));
169end;
170
171procedure TfrmDeviceSelect.FormShow(Sender: TObject);
172begin
173 SetFormPosition(Self);
174 inherited;
175end;
176
177procedure TfrmDeviceSelect.FormClose(Sender: TObject;
178 var Action: TCloseAction);
179begin
180 inherited;
181 SaveUserBounds(Self);
182end;
183
184end.
Note: See TracBrowser for help on using the repository browser.