Custom Print Preview
I'm converting an app I created using RB4.11 to use RB6.03 (7 soon).
I had a custom print preview form, created using the steps which are still
in the Developer's Guide (& now out of date). It seems all of this has
changed in 6.03.
1) Am I right in thinking I now have to design my preview form in code, I
can't use the Delphi Form Designer?
2) How can I set the contents of the 'Type' and 'Where' boxes on the Print
dialog (I want them to be persistent).
TIA,
Dave Riley
Tangent Software Ltd, Reading, UK
I had a custom print preview form, created using the steps which are still
in the Developer's Guide (& now out of date). It seems all of this has
changed in 6.03.
1) Am I right in thinking I now have to design my preview form in code, I
can't use the Delphi Form Designer?
2) How can I set the contents of the 'Type' and 'Where' boxes on the Print
dialog (I want them to be persistent).
TIA,
Dave Riley
Tangent Software Ltd, Reading, UK
This discussion has been closed.
Comments
demo project which replaces the preview form. Look for this code in
TfrmDMMain.btnSwitchPreviewerClick:
ppRegisterForm(TppCustomPreviewer, TfrmTwoPagePreview);
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
FYI the only reason I need to customize the preview dialog is because the
standard one does'nt cater for people who don't use a mouse. All I do is
add a menu so the various functions can be accessed using the keyboard.
Also, please could you answer my 2nd question-
How can I access the settings which appear in the 'Type' and 'Where' boxes
on the Print dialog (in order that I can make them persistent - if a user
nearly always uses Excel output [TXtraDev] then once he's set the combo to
that it will always come up with it selected by default).
Dave.
On Wed, 25 Sep 2002 10:31:50 -0500, support@digital-metaphors.com (Jim
so that doesn't help for the device options in the print dialog. Use the
Report.OnPrintDialogClose event to get at the Report.PrintDialog. Then you
can read the Report.PrintDialog's DeviceType and TextFileName properties.
Save these values in variables and set them on the report object's
properties for the next Report that is loaded by the user.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I can successfully read the DeviceType and TextFileName in the
OnPrintDialogClose handler but I'm not sure at what point I can set the
values for a new report.
I tried the OnPrintDialogCreate event but if I assign anything other than
'Printer' to the PrintDialog.DeviceType property I get an access
violation. This doesn't happen when I assign it but later on somewhere.
Dave.
On Thu, 26 Sep 2002 10:34:11 -0500, support@digital-metaphors.com (Jim
before running the next report. If you are loading report templates form
file or database, then use the Report.Template.OnLoadEnd event to set the
properties on the report. See the tech-tips templates newsgroup for an
article on using template events.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
DeviceType seems to be ignored, when the Print dialog comes up it always
has 'Text File' selected in the Type combo.
I took a look at ppPDlg.pas and it seems to me that what I want to do, ie
preset the entry selected in the Type combo, is impossible. So I guess
I'll have to implement my own print to file dialog.
Dave.
On Thu, 26 Sep 2002 16:30:15 -0500, support@digital-metaphors.com (Jim
...TForm1...
private
{ Private declarations }
FDevice: String;
FFileName: String;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
FFileName := 'C:\Tech Support\Report.txt';
FDevice := 'ReportTextFile';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ppReport1.Print;
end;
procedure TForm1.ppReport1PrintDialogClose(Sender: TObject);
begin
FDevice := ppReport1.PrintDialog.DeviceType;
FFileName := ppReport1.PrintDialog.TextFileName;
end;
procedure TForm1.ppReport1PrintDialogCreate(Sender: TObject);
begin
ppReport1.PrintDialog.DeviceType := FDevice;
ppReport1.PrintDialog.TextFileName := FFileName;
end;
end.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
get an access violation (not in the assignment, it occurs later on).
Dave.
On Fri, 27 Sep 2002 10:12:58 -0500, support@digital-metaphors.com (Jim
entries on the print dialog while the current report object is in existance.
You could extend this to write to an ini file.
http://www.digital-metaphors.com/tips/SaveTppPrintDialogSettings.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
'Excel File' to ppReport.PrintDialog.DeviceType, rather than 'ExcelFile'.
This is what caused the AV.
Thanks Jim, all sorted now.
Dave.
On Mon, 30 Sep 2002 15:06:11 -0500, support@digital-metaphors.com (Jim