Create (Report: IReportBox; Sheet: IPrxSheet; Object: ITabObject; Type: TabObjectChangeType, Value: IGxRectF; Cancel: Boolean);
Create (Report: Prognoz.Platform.Interop.Report.ReportBox; Sheet: Prognoz.Platform.Interop.Report.IPrxSheet; Object: Prognoz.Platform.Interop.Tab.ITabObject; Type: Prognoz.Platform.Interop.Tab.TabObjectChangeType; Value: Prognoz.Platform.Interop.Drawing.IGxRectF; Cancel: boolean);
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
Value. Object's new position and size
Cancel. Indicates whether object rotation must be canceled.
The Create constructor creates an argument of the event that occurs before moving or resizing an object.
By default event arguments are generated automatically on occurring an event. A constructor is required for manual calling the event.
Available values of the Cancel parameter:
True. Object move or resize is canceled
False. Object move or resize is performed.
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 OnBeforeObjectChange 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 UserOnBeforeObjectChange procedure must be allocated by the OnBeforeObjectChange event handler for the ReportBox1 component.
For the Fore.NET example, the ReportBeforeObjectRectChangeEventArgs_Create_FormForm_Shown procedure must be set by the Shown event handler for the form.
Add links to the Drawing, Report, Tab system assemblies.
// Create a custom handler of the OnBeforeObjectChange event
Sub UserOnBeforeObjectChange(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 UserOnBeforeObjectChange;
// Call the OnBeforeObjectChange custom event handler
Public Sub UserProc;
Var
Report: IPrxReport;
Sheet: IPrxSheet;
Tab: ITabSheet;
rObject: ITabObject;
Rect: IGxRectF;
Argument: IReportBeforeObjectRectChangeEventArgs;
Begin
Report := ReportBox1.Report.Report;
Sheet := Report.Sheets.Item(0);
Tab := (Sheet As IPrxTable).TabSheet;
rObject := Tab.Objects.Object("PrxShape1") As ITabObject;
Rect := New GxRectF.Create(10, 10, 60, 60);
Argument := New ReportBeforeObjectRectChangeEventArgs.Create(ReportBox1, Sheet, rObject, TabObjectChangeType.Rect, Rect, False);
ReportBox1.OnBeforeObjectChange(ReportBox1, Argument);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
// Create a OnBeforeObjectChange custom event handler
Public Sub UserOnBeforeObjectChange(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 UserOnBeforeObjectChange;
// Determine the UserOnBeforeObjectChange custom handler to the OnBeforeObjectChange event
Private Sub ReportBeforeObjectRectChangeEventArgs_Create_FormForm_Shown(sender: System.Object; e: System.EventArgs);
Begin
ReportBoxNet1.OnBeforeObjectChange += New Prognoz.Platform.Forms.Net.ReportBoxNet.OnBeforeObjectChangeEventHandler(UserOnBeforeObjectChange);
End Sub;
// Call the OnBeforeObjectChange custom event handler
Public Sub UserProc();
Var
Report: IPrxReport;
Sheet: IPrxSheet;
Tab: ITabSheet;
rObject: ITabObject;
Rect: GxRectFClass = New GxRectFClass.Create();
Argument: ReportBeforeObjectRectChangeEventArgsClass = New ReportBeforeObjectRectChangeEventArgsClass.Create();
Begin
Report := ReportBoxNet1.Source.Report;
Sheet := Report.Sheets.Item[0];
Tab := (Sheet As IPrxTable).TabSheet;
rObject := Tab.Objects.Object["PrxShape1"] As ITabObject;
Rect.Create(10, 10, 60, 60);
Argument.Create(ReportBoxNet1.CtrlBox As ReportBox, Sheet, rObject, TabObjectChangeType.toctRect, Rect, False);
UserOnBeforeObjectChange(ReportBoxNet1, Argument);
End Sub UserProc;
As a result , the UserProc procedure calls the UserOnAfterObjectChange custom event handler.
See also: