How to read zoomPercentage
Is there a way to read the zoomPercentage of a form outside the
OnPreviewFormCreate event?
I am able to set the zoomSetting (and zoomPercentage) in the
OnPreviewFormCreate event using
with myReport.Previewform do
begin
formStyle := fsMDIChild;
TppViewer(Viewer).zoomSetting := zs100Percent;
end;
I want to be able to record a users zoomSetting for later reuse.
Is there a type cast to allow
with (MDIChildren[0] as ????).PreviewForm do
begin
myZoomPercentage := TppViewer(Viewer).zoomPercentage;
end;
Thanks
Russell
OnPreviewFormCreate event?
I am able to set the zoomSetting (and zoomPercentage) in the
OnPreviewFormCreate event using
with myReport.Previewform do
begin
formStyle := fsMDIChild;
TppViewer(Viewer).zoomSetting := zs100Percent;
end;
I want to be able to record a users zoomSetting for later reuse.
Is there a type cast to allow
with (MDIChildren[0] as ????).PreviewForm do
begin
myZoomPercentage := TppViewer(Viewer).zoomPercentage;
end;
Thanks
Russell
This discussion has been closed.
Comments
TppReport(MDIChildren[0].Owner as
TppReport).PreviewFormSettings.zoomPercentage always reports 100
even when in the OnPreviewFormCreate event the zoomSetting is set to
zsPercentage, even when the user has changed the zoomPercentage.
I am trying to find the zoomPercentage after a user may have changed it, so
I can give the zoomPercentage that value, if the user wants it, the next
time the report is invoked.
Thanks
Russell
I doubt that 'MDIChildren[0].Owner' will be your report component.
You have to detect the report component first, then you can use the following code ...
myZoomSetting := TppViewer(myReport.PreviewForm.Viewer).ZoomSetting;
regards,
Chris Ueberall;
Thanks for your reply. I am looking for ZoomPercentage, but the code to read
these values you suggest should work for both.
Here is the code which works:
if ((MDIChildren[0].Owner as TppReport).inheritsFrom(TppReport)) then
begin
myZP := TppViewer(TppReport(MDIChildren[0].Owner as
TppReport).PreviewForm.Viewer).zoomPercentage;
end;
Thanks
Russell
myZP :=
TppViewer(TppReport(MDIChildren[0].Owner).PreviewForm.Viewer).CalculatedZoom
;
should be used to get the zoomPercentage. the property "zoomPercentage" is
not updated when a user changes the zoomPercentage.
Russell
when the user changes the zoom percentage the property will be updated.
Be aware, that property 'ZoomPercentage' is only valid when property 'ZoomSetting' is 'zsPercentage'.
Yes it would nice when property 'ZoomPercentage' would be updated for the other settings too (I did my test with RB 5.6, this may have been changed in the current version). But re-using the last zoom settings should be of no problem then.
HTH,
Chris Ueberall;