Saving Report Changes when using the end-user designer

Category

Rave - General

Question

I have purchased the end-user license for Rave, but there is no save option that shows up in the designer when executing the visual desinger from my application using either the ravepack.dll or ravesolo.dll. How do I save the changes that have been made from within the visual designer?

Solution

Although it may seem like we have left out a major feature in not providing, by default, a save button in the visual designer, we have provided a way for you to easily add this feature. The reason we didn't provide one by default is that we didn't want to limit you to a particular location when saving a report. For instance, you may want to save the report to disk or you may want to save it into a database. With Rave you have the freedom to save it to any location that fits your needs.

Since calling the Design method to bring up the visual designer returns true or false, based on whether the user made changes to the report, the following method will save the report to disk with the name as specified in the ProjectFile property of the TRaveProject component.

Delphi Example:

If RaveProject1.Design then begin
    If MessageDlg(Trans('Save changes to project ') +
                        RaveProject1.ProjectFile + '?',
                        mtConfirmation,
                        [mbYes,mbNo,mbCancel],0) = mrYes then
    begin
      RaveProject1.Save;
    end; { if }
  end; { if }

C++Builder Example:

if (RaveProject1->Design()) {
    if (MessageDlg("Save changes to project " + 
                   RaveProject1->ProjectFile + "?",
                   mtInformation, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
    {
      RaveProject1->Save();
    }// if
  }// if

If your users really miss not having a save or saveas button from within the visual designer, this can be easily accomplished as well. You would simply define the OnDesignerSave and OnDesignerSaveAs events attached to the TRaveProject component. Once these events are defined, menu items will show up under the Project menu item in the visual designer.