How to override the standard setupdialog

Category

Rave - General

Question

How can I change the setup-dialogbox in an other look or in an other language, for example german ?

Solution

In Rave 5 or later, exist a standard setup-form. Many user , especially in "non"-english countries, would localize this dialog.

Normally the Printsetup Form is displayed when executing the report to allow the user to select the report destination and other settings (copies, file format to use).

Copy the rpFormSetup.pas- and rpFormSetup.dfm-file in the project folder and change the filenames and the unit-name inside the pas-file and the form-name. for example in dtFormSetup (dt is the abbreviation of "deutsch"- german).

Sample Files: rave_dtformsetiup.zip

Add dtFormSetup to the uses statement in the project. Make visual changes and localization to the form and save it.

Connect the RvSystem component with the RvProject component.
Select the RvSystem component and create the OverrideSetup event and enter the following code:

procedure TForm1.RvSystem1OverrideSetup(ReportSystem: TRvSystem;
  OverrideMode: TOverrideMode; var OverrideForm: TForm);
begin
  case
    OverrideMode of
    omCreate:
      begin
        OverrideForm := TdtSetupForm.Create(nil);
        OverrideForm.Caption := RvSystem1.TitleSetup;
        (OverrideForm as TdtSetupForm).ReportSystem := ReportSystem;
      end;
    omShow:
      begin
        with OverrideForm as TdtSetupForm, ReportSystem do
        begin
          PreviewSetup := False;
          Aborted := ShowModal = mrCancel;
        end;
      end;
    omWait:
      begin
	{because showModal: no wait necessary!)
      end;
    omFree:
      begin
        OverrideForm.Free;
      end;
  end;
end;

Compile and run any of the reports, your special Setup Form should be displayed when you execute a rave-report. -> this way doesn't override your setupform on a rave-update, too.