Change Preview: Let User change elements.

dschuchdschuch Dresden,Germany
edited October 2012 in FastReport 4.0
Hy,

we want to realize the following scenario:

A user should change the preview, without having the full "Edit Preview", because its to complicated.

Esp. the user should be able to delete elements from the preview, before the report is printed/send by email.

So we tried out the following possibilities:

In FR, we made a red Shape around the elemets, the user can change. So for example a Logo and a Signature, so if the user click on that element, the element should hide. We made a Event like the following, the MessageBox is working but the element is still there.
procedure ShapeHideLogoClickOnPreviewDblClick(Sender: TfrxView; Button: TMouseButton; Shift: Integer; var Modified: Boolean);
begin
 ShowMessage('Test');
 MyTfrxPictureView.Visible:=False;
end;

That wasnt working, so we tried out it in Delphi:

We made a Dialog, that is shown besides the Preview. Inside the Dialog, we made some Buttons: Hide element1, hide element2 and so on. Inside Delphi, we used the code:
if Assigned(frxReport1.PreviewPages.Page[0].FindObject('BackGroundPicture')) then
 frxReport1.PreviewPages.Page[0].FindObject('BackGroundPicture').Free;

But its not working at all.

There has to be a way: if i go to the build-in editmode of the preview, delete an object, close edit preview and say "yes, save changes to preview", its working. so what we have to do, to let FR rebuild the preview page?

Daniel.

Comments

  • edited 7:32PM
    Hi.

    I think you must re-run the report to make changes apply. You can store your choice of visibility in a variable, and then act according to this variable when report is run.
    procedure ShapeHideLogoClickOnPreviewDblClick(Sender: TfrxView; Button: TMouseButton; Shift: Integer; var Modified: Boolean);
    begin
     Set('MyPicVisibleVar', '0');
     Report.ShowReport;
    end;
    
    procedure MyTfrxPictureViewOnBeforePrint(Sender: TfrxComponent);
    begin
     if Get('MyPicVisibleVar') = '0' then
       MyTfrxPictureView.Visible:=False;
    end;
    

    Remember also to declare 'MyPicVisibleVar' in the Report|Variables...

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.