DeviceType returns a string
DeviceType returns a string in the following code. Have I missed something?
The user always wants the portrait orientation on the screen; the print
orientation is selectable by the user.
procedure TFormRB.ppReportLabelBeforePrint(Sender: TObject);
begin
if IniRec.DoDebug then
begin
Logit(IniRec.DebugFile, '[ppReportLabelBeforePrint]DeviceType: ' +
ppReportLabel.DeviceType);
end;
if ppReportLabel.DeviceType = 'Screen' then
begin
ppReportLabel.PrinterSetup.Orientation := poPortrait;
ppReportLabel.PreviewFormSettings.ZoomSetting := zs100Percent;
end else
ppReportLabel.PrinterSetup.Orientation := FOrientation;
end;
Todd
The user always wants the portrait orientation on the screen; the print
orientation is selectable by the user.
procedure TFormRB.ppReportLabelBeforePrint(Sender: TObject);
begin
if IniRec.DoDebug then
begin
Logit(IniRec.DebugFile, '[ppReportLabelBeforePrint]DeviceType: ' +
ppReportLabel.DeviceType);
end;
if ppReportLabel.DeviceType = 'Screen' then
begin
ppReportLabel.PrinterSetup.Orientation := poPortrait;
ppReportLabel.PreviewFormSettings.ZoomSetting := zs100Percent;
end else
ppReportLabel.PrinterSetup.Orientation := FOrientation;
end;
Todd
This discussion has been closed.
Comments
The Report.DeviceType property does not change, it remains set to what the
user chooses before the report is printed. If you are trying to check to
see if the user is printing to the printer, you need to check if the
Report.PrinterDevice is nil. Take a look at the article below.
------------------------------------------
Tech Tip: Detecting whether Report was
Printed to the Printer
------------------------------------------
The Report.AfterPrint event can be used to
determine whether the report was printed
to the printer (rather than preview, ...).
Example:
procedure TForm1.ppReport1AfterPrint(Sender: TObject);
begin
if (ppReport1.PrinterDevice <> nil) then
ShowMessage('Report was printed to the printer');
end;
Note: If the user cancels the report while it
is running, then the Report.OnCancel event will
fire, followed by the Report.AfterPrint event.
Example:
procedure TForm1.ppReport1Cancel(Sender: TObject);
begin
ShowMessage('Printing cancelled by user');
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
enumerated value and on my computer all works as expected, but on
the client's computer when the DeviceType is Screen, the
orientation remains the same as the orientation specified in the
Printer orientation.
Todd
My debug file shows that it is "Screen" when in the screen mode,
and when the user selects to print, it returns "Print". However,
let me check out the article.
Todd
enumerated type resolves to. You will notice that the DeviceType property
is a String type.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com