Remove Print button from Preview?
Hi Team,
Win 10, D10.2.2, latest RBEnt.
I want to allow the end user to see the report on the screen only and not be able to physically print or do anything
else with it.
Can I, if so Where/how, disable, preferably remove, the print button on the Preview screen?
Regards & TIA,
Ian
Win 10, D10.2.2, latest RBEnt.
I want to allow the end user to see the report on the screen only and not be able to physically print or do anything
else with it.
Can I, if so Where/how, disable, preferably remove, the print button on the Preview screen?
Regards & TIA,
Ian
This discussion has been closed.
Comments
You can use the OnShow Event of Previewform
to setup your OnShow Handler, where you can access those buttons:
ppReport.OnPreviewFormCreate ==
var
vForm:TppCustomPreviewer;
begin
vform:=tppreport(sender).Previewform;
vForm.OnShow:=my_previewformonshow;
end;
and later
procedure previewformonshow(Sender: TObject);
var
vForm:TppPrintPreview;
begin
vform:=TppPrintPreview(sender);
if vform<>nil then begin
// now access buttons etc.
vForm.BringToFront;
end;
end;
Rgds, Yusuf
--
Not sure I know how exactly to do that.
I am playing with ppViewer att to see what I can or cannot do with that.
Regards,
Ian
I should have indicated, I am using the end-user core to retrieve the report into ppReport from the rbxxxx files.
Ian
So given that you have a TppReport instance that you are presumably
using to call Print or PrintToDevices, why are you not able to make use
of Yusuf's code example?
Paul
The Preview Dialog contains numerous helper properties which allow minor
control over the report previewer. You can use the Report.PreviewForm
property to access this (as Yusuf mentioned).
http://www.digital-metaphors.com/rbWiki/Output/Preview/Hide_Print_Button_on_Print_Preview
Another option is to create a custom preview plugin.
http://www.digital-metaphors.com/rbWiki/Plugins/Dialogs/Preview_Plugin
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Trying he first option as it seems the simplest.
From my parent form I call the report with the following..
{code}
procedure TJobTicketsForm.RepairReportPrintClick(Sender: TObject);
begin
//
if InStr(mscCoyJTPrint, dmC.JobTickets.FieldByName('JobStatus').AsString, ';') then
begin
sJobNo := alltrim(dmC.JobTickets.FieldByName('Job #').AsString);
//
with ReportsFrm.ReportsForm do
begin
ppRE1.LoadReport('Customer Repair Report', 2);
ppR1.ShowAutoSearchDialog := False;
ppR1.AutoSearchFields[0].SearchExpression := sJobNo;
ppR1.Print;
end;
//
end
else MessageDlg(sPrintMsg, mtError, [mbOK], 0);
//
end;
{code}
ppRE1 & ppR1 are on the core module of the end-user example module, 'ReportsForm'.
I have added 'ppPrvDlg' in the uses of ReportsForm and the following code..
{code}
procedure TReportsForm.ppR1PreviewFormCreate(Sender: TObject);
begin
TppPrintPreview(ppR1.PreviewForm).PrintButton.Visible := False;
end;
{code}
I still get the print button on the Preview screen.
Clearly I still have something wrong. :-(
Regards,
Ian
event is likely being lost.
Try re-assigning the event reference after the template is loaded.
http://www.digital-metaphors.com/rbWiki/Design/Templates/How_To...Reassign_Event_Handlers
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Tks Nico.
Regards,
Ian