Designer Saving Event passing wrong parameter

Stimulsoft Reports.NET discussion
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Designer Saving Event passing wrong parameter

Post by johnham »

When I hook the Designer's Saving Event to provide custom saving logic, it passes a StiSavingObjectEventArgs parameter which contains a member named "SaveAs" which is supposed to denote whether a user has press "Save" or "SaveAs".

Currently this Parameter's SaveAs member is always true on the ribbon interface no matter what gets used to Save a report design.

Thanks,
John Hamilton
Hamilton & Company, LLC
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Designer Saving Event passing wrong parameter

Post by Jan »

Hello John,

That is correct if you never save report and call Save command. In this case report designer call Save As command instead Save command.

Thank you.
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Designer Saving Event passing wrong parameter

Post by johnham »

I realized that but I cannot EVER get this parameter to return false. I have opened an already saved report and then selected "SAVE" (not "SAVE AS") and this parameter still remains true. As far as I can tell this parameter is not working correctly.

Thanks,
John Hamilton
Hamilton & Company, LLC
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Designer Saving Event passing wrong parameter

Post by Jan »

Hello,

I have checked following code:

Code: Select all

StiOptions.Engine.GlobalEvents.SavingReportInDesigner += new StiSavingObjectEventHandler(GlobalEvents_SavingReportInDesigner);

void GlobalEvents_SavingReportInDesigner(object sender, StiSavingObjectEventArgs e)
{
   MessageBox.Show("test");
}
I have test it with Ribbon Gui and Standard Gui. All variants work fine. Can you provide sample project which reproduce this problem?

Thank you.
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Designer Saving Event passing wrong parameter

Post by johnham »

Try the following:

Code: Select all

StiOptions.Engine.GlobalEvents.SavingReportInDesigner += new StiSavingObjectEventHandler(GlobalEvents_SavingReportInDesigner);

void GlobalEvents_SavingReportInDesigner(object sender, StiSavingObjectEventArgs e)
{
   if (e.SaveAs)
   {
      MessageBox.Show("Save As");
   }
   else
   {
      MessageBox.Show("Save Only");
   }
}
My problem is the I can never get it to trigger "Save Only".
Thanks,
John Hamilton
Hamilton & Company, LLC
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Designer Saving Event passing wrong parameter

Post by johnham »

:grinder: bump :grinder:
Thanks,
John Hamilton
Hamilton & Company, LLC
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Designer Saving Event passing wrong parameter

Post by Jan »

Hello,

Problem detected. Please get build from 13 July. Also you can add following lines of code to event handler:

Code: Select all

StiDesignerControl designer = sender as StiDesignerControl;
designer.ReportNeverSaved = false;
Thank you.
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Designer Saving Event passing wrong parameter

Post by johnham »

This is still not working for me.

I just need to know whether "Save As" or "Save" has been clicked. I really don't need any logic to decide whether I need to SaveAs. My save code can tell if the Report hasn't been saved and SaveAs still needs to be used.

This is how I envision it working. Set e.SaveAs depending on which menu item gets clicked "Save" or "Save As". Set ReportNeverSaved depending on whether the report actually has been saved or not. Then I can write logic like the following.

Code: Select all

StiDesignerControl designer = sender as StiDesignerControl;
if (e.SaveAs || designer.ReportNeverSaved)
{
    MessageBox.Show("Prompt for Filename Here");
}
else
{
    MessageBox.Show("Save using current filename");
}
Currently I am testing this by loading a currently saved report out of my SQL Database using my custom loading logic and LoadReportFromString. Then I am changing the report and then clicking on "Save". It still sets e.SaveAs = true.

Thanks,
John Hamilton
Hamilton & Company, LLC
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Designer Saving Event passing wrong parameter

Post by johnham »

Is there any help with this?

Thanks,
John Hamilton
Hamilton & Company, LLC
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Designer Saving Event passing wrong parameter

Post by Jan »

Hello John,

Please use following static property - StiOptions.Designer.IgnoreOptionReportNewerSaved. Set it to true.

Thank you.
Post Reply