CreateObjectChangeArgs (Report: IReportBox; Sheet: IPrxSheet; Object: ITabObject; Type: TabObjectChangeType);
CreateObjectChangeArgs (Report: Prognoz.Platform.Interop.Report.ReportBox; Sheet: Prognoz.Platform.Interop.Report.IPrxSheet; Object: Prognoz.Platform.Interop.Tab.ITabObject; Type: Prognoz.Platform.Interop.Tab.TabObjectChangeType);
Report. The component, for which event is generated
Sheet. The report sheet, for which the event is generated
Object. An object, for which an event is generated
Type. Type of change that occurs with an object.
The CreateObjectChangeArgs constructor creates an argument of the event that occurs on changing an object.
By default event arguments are generated automatically on occurring an event. A constructor is required for manual calling the event.
Executing the example requires a form containing the ReportBox component named ReportBox1 and the UiReport component named UiReport1 which is a data source for ReportBox1. Set the Active property of the UiReport1 component to True. UiReport1 must contain loaded regular report with shapes on active sheet.
Custom handler for the OnAfterObjectChange event in the ReportBox1 component will be created and called in the example.
Instead of the Fore components use Fore.NET analogs.
For the Fore example, the UserOnAfterObjectChange procedure must be allocated by the OnBeforeObjectChange event handler for the ReportBox1 component.
For the Fore.NET example, the ReportObjectChangeEventArgs_CreateObjectChangeArgs_NET_FormForm_Shown procedure must be set by the Shown event handler for the form.
Add links to the Report, Tab system assemblies.
// Call the OnAfterObjectChange custom event handler
Sub UserProc;
Var
Report: IReportBox;
Sheet: IPrxSheet;
Shape: IPrxShape;
Object: ITabObject;
Argument: ReportObjectChangeEventArgs;
Begin
Report := ReportBox1.Report.Report As IReportBox;
Sheet := Report.Report.Report.Sheets.Item(0);
Object := Shape As ITabObject;
Argument := New ReportObjectChangeEventArgs.CreateObjectChangeArgs(ReportBox1, Sheet, Object, TabObjectChangeType.Angle);
ReportBox1.OnAfterObjectChange(ReportBox1, Argument);
End Sub UserProc;
// Custom handler of the OnAfterObjectChange event
Sub UserOnAfterObjectChange(Sender: Object; Args: IReportObjectChangeEventArgs);
Begin
Select Case Args.Type
Case TabObjectChangeType.Angle:
Debug.WriteLine("Object '" + Args.Object.Id + "' was rotated");
Case TabObjectChangeType.Rect:
Debug.WriteLine("Object '" + Args.Object.Id + "' was moved or resized");
End Select;
End Sub UserOnAfterObjectChange;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
// Custom handler of the OnAfterObjectChange event
Public Sub UserOnAfterObjectChange(Sender: Object; Args: IReportObjectChangeEventArgs);
Begin
Select Case Args.Type
Case TabObjectChangeType.toctAngle:
System.Diagnostics.Debug.WriteLine("Object '" + Args.Object.Id + "' was rotated");
Case TabObjectChangeType.toctRect:
System.Diagnostics.Debug.WriteLine("Object '" + Args.Object.Id + "' was moved or resized");
End Select;
End Sub UserOnAfterObjectChange;
// Determine the UserOnAfterObjectChange custom handler to the OnAfterObjectChange event
Private Sub ReportObjectChangeEventArgs_CreateObjectChangeArgs_NET_FormForm_Shown(sender: System.Object; e: System.EventArgs);
Begin
ReportBoxNet1.OnAfterObjectChange += New Prognoz.Platform.Forms.Net.ReportBoxNet.OnAfterObjectChangeEventHandler(UserOnAfterObjectChange);
End Sub;
// Call custom handler of the OnAfterObjectChange event
Public Sub UserProc();
Var
Report: IReportBox;
Sheet: IPrxSheet;
Shape: IPrxShape;
TabObject: ITabObject;
TabObjectChange: TabObjectChangeType;
Argument: ReportObjectChangeEventArgs;
Begin
Report := ReportBoxNet1.Source.Report As IReportBox;
Sheet := Report.Report.Report.Sheets.Item[0];
TabObject := Shape As ITabObject;
TabObjectChange := TabObjectChangeType.toctAngle;
Argument := New ReportObjectChangeEventArgsClass.Create();
Argument.CreateObjectChangeArgs(ReportBoxNet1.CtrlBox As ReportBox, Sheet, TabObject, TabObjectChange);
UserOnAfterObjectChange(ReportBoxNet1, Argument);
End Sub UserProc;
As a result , the UserProc procedure calls the UserOnAfterObjectChange custom event handler.
See also: