Save As... versus Save

TurntwoTurntwo Folsom, CA
edited 12:53PM in FastReport .NET
Is there anyway to tell if the user selected Save As... versus Save when using a CustomSaveDialog? If the user is editing an existing report, I'd like Save to produce a dialog with the existing values filled in (key, description, etc.), whereas for a Save As... I'd like to have the key value and description blank and the key value editable. I couldn't find a way to know the difference in the CustomSaveDialog event.

Thanks.

Comments

  • edited 12:53PM
    Hello,

    The difference is that when you save an existing report, the Save dialog is not displayed. When you save a new (untitled) report, or do Save As, you will see the dialog.
  • TurntwoTurntwo Folsom, CA
    edited 12:53PM
    Actually, when I handle CustomSaveDialog in my code, it is called whether I choose Save or Save As... So my dialog displays for both.
  • edited 12:53PM
    That's true if you save the newly created report (untitled.frx). Once you saved it, the next "Save" command (either File|Save or Save button in the toolbar) will silently save the report. Look at the Demos\C#\CustomOpenSaveDialogs demo.
  • TurntwoTurntwo Folsom, CA
    edited 12:53PM
    I checked the Demo app, and you are right, it works as you described. However, my project still doesn't. I did some further testing, and it appears to be related to the use of the e.Data property. I am loading this with a business object used to save the report to the database. If I leave e.Data null, my report gets its name, and the Save button doesn't pull up the Save Dialog anymore. However, if I set e.Data = myBO, then the report doesn't get the name (it remains Untitled.frx), and the Save brings up the dialog everytime.

    1. Is there a way to use e.Data and still have the Save function as you describe.

    2. Is there a way to tell the Designer that it is an existing report when it is first loaded? I am loading it from the database, then calling for the Designer using report.Design. Since it is an existing report, it would be nice if the Save acted like it does after the first Save. Then I could use the SaveDialog as a save as, and not worry about them changing the key when trying to save an existing report.

    Thanks.
  • edited 12:53PM
    Hello,

    1) I will fix this behavior in the monday's daily build.
    2) Load the report and set its FileName property:
        private void DesignReport()
        {
          using (Report report = new Report())
          {
            report.LoadBaseReport += new CustomLoadEventHandler(report_LoadBaseReport);
            OpenReport(report, "1");
            report.FileName = "1";
    
            report.Design();
          }
        }
    

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.