printer button
Hi
Can I disable (or delete) the printer button in a report preview ?
The user do not print any reports in my application, only view.
Thanks
Sidney Aparecido Muriano
APP Sistemas
Can I disable (or delete) the printer button in a report preview ?
The user do not print any reports in my application, only view.
Thanks
Sidney Aparecido Muriano
APP Sistemas
This discussion has been closed.
Comments
a delphi project which does this, via the email address you sent to
support@digital-metaphors.com
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
functionality:
unit myCloseButtonPreviewPlugIn;
interface
uses
Buttons,
ppPreview;
type
TmyPreviewPlugIn = class(TppPreview)
private
function GetButtonForPreviewAction(aPreviewAction:
TppPreviewActionType): TSpeedButton;
public
procedure BeforePreview; override;
end;
implementation
uses
SysUtils, Controls;
procedure TmyPreviewPlugIn.BeforePreview;
var
lCloseButton: TSpeedButton;
begin
inherited BeforePreview;
lCloseButton := GetButtonForPreviewAction(paCancel);
if (lCloseButton = nil) then
raise Exception.Create('TmyPreviewPlugIn.BeforePreview: Unable to find
close button.');
lCloseButton.Visible := False;
end;
function TmyPreviewPlugIn.GetButtonForPreviewAction(aPreviewAction:
TppPreviewActionType): TSpeedButton;
var
liIndex2: Integer;
liIndex: Integer;
lControl: TControl;
begin
liIndex2 := 0;
Result := nil;
liIndex := 0;
while (Result = nil) and (liIndex < Toolbar.ControlCount) do
begin
lControl := Toolbar.Controls[liIndex];
if (lControl.ComponentCount = 0) then
begin
if (lControl.Tag = Ord(aPreviewAction)) then
Result := TSpeedButton(lControl);
end
else
begin
liIndex2 := 0;
while (Result = nil) and (liIndex2 < lControl.ComponentCount) do
begin
if (lControl.Components[liIndex2].Tag = Ord(aPreviewAction))
then
Result := TSpeedButton(lControl.Components[liIndex2])
else
Inc(liIndex2);
end;
end;
Inc(liIndex);
end;
end;
initialization
TppPreviewPlugIn.Register(TmyPreviewPlugIn);
finalization
TppPreviewPlugIn.UnRegister(TmyPreviewPlugIn);
end.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
have grepped for the TppPreview class declaration in the source and cannot
find it. Am I missing something or do I have the wrong version of
ReportBuilder?
AFAIK, 'TppPreview' ('ppPreview.pas') was introduced in ReportBuilder 6.0.
regards,
Chris Ueberall;
TppPreview was introduced I think around RB version 6.0.
With older versions you can replace the built-in preview dialog as
described in the article below.
------------------------------------------------------------
Tech Tip: Replacing Built-in Dialogs/Forms in ReportBuilder
------------------------------------------------------------
ReportBuilder has an open architecture for replacing any of the built-in
dialogs. You can replace any of the built-in dialogs by creating a new
form that inherits from an abstract ancestor and then registering it as
the new built-in dialog.
For example to replace ReportBuilder's preview dialog you could
1. Create a new Preview dialog by renaming ReportBuilder's default
preview dialog, then doing a SaveAs to save it under another unit name.
The default dialog resides in RBuilder\Source\ppPrvDlg.pas and the form
is called ppPreviewDialog. You should assign your form a unique name,
for example, myPreviewDlg, and save the unit to another name. Also save
the unit to the directory where your other forms are stored (not
RBuilder\Source).
2. Make desired changes.
You will notice that the preview dialog inherits from an ancestor
TppCustomPreviewDialog - this ancestor resides in ppForms.pas (where all
the abstract ancestor forms for ReportBuilder are defined).
3. Register the new form.
Declare an initializtion section at the bottom of the unit:
initialization
ppRegisterForm(TppCustomPreviewer, TmyPreviewDlg);
4. Add the new unit to your project and compile.
Now your preview dialog should be automatically created and destroyed by
ReportBuilder. The two page preview dialog in the
RBuilder\Demos\Reports\Demo.dpro was created this same way. The only
difference is the ppRegisterForm call is in then OnClick event of the
button.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I also have the problem to disable the print button in the preview. I have
the actual version of RB. Could you please mail me that code too ?
http://www.digital-metaphors.com/tips/HidePrintButtonPlugin.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com