Page 1 of 2
Designer Saving Event passing wrong parameter
Posted: Thu Jul 02, 2009 5:55 pm
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.
Designer Saving Event passing wrong parameter
Posted: Fri Jul 03, 2009 5:53 am
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.
Designer Saving Event passing wrong parameter
Posted: Tue Jul 07, 2009 3:37 pm
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.
Designer Saving Event passing wrong parameter
Posted: Wed Jul 08, 2009 3:38 am
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.
Designer Saving Event passing wrong parameter
Posted: Wed Jul 08, 2009 10:14 am
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".
Designer Saving Event passing wrong parameter
Posted: Fri Jul 10, 2009 8:29 am
by johnham
:grinder: bump :grinder:
Designer Saving Event passing wrong parameter
Posted: Fri Jul 10, 2009 4:18 pm
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.
Designer Saving Event passing wrong parameter
Posted: Tue Jul 14, 2009 9:58 am
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.
Designer Saving Event passing wrong parameter
Posted: Sun Jul 19, 2009 8:39 pm
by johnham
Is there any help with this?
Designer Saving Event passing wrong parameter
Posted: Tue Jul 21, 2009 6:21 am
by Jan
Hello John,
Please use following static property - StiOptions.Designer.IgnoreOptionReportNewerSaved. Set it to true.
Thank you.