Create (Report: IReportBox; Sheet: IPrxSheet; Object: ITabObject; Type: TabObjectChangeType, Value: 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. It determines whether object rotation is 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.
A custom handler for the OnBeforeObjectChange event in the ReportBox1 component is created and called in the example.
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);
UserOnBeforeObjectChange(ReportBox1, Argument);
End Sub UserProc;
As a result , the UserProc procedure calls the UserOnAfterObjectChange custom event handler.
See also: