TabSheetBox.OnBeforeObjectChange

Syntax

Sub OnBeforeObjectChange(Sender: Object; Args: ITabObjectChangeEventArgs);

Begin

// Set of operators

End Sub OnBeforeObjectChange;

Parameters

Sender. The component that generated an event.

Args. Parameters of the object, in which an event occurred.

Description

The OnBeforeObjectChange event occurs before changing an object.

Comments

Object parameters can be cast to various interfaces depending on the type of change on an object. To do this, use value of the ITabObjectChangeEventArgs.Type property returned by the Args parameter:

After an object is changed, the OnAfterObjectChange event occurs.

Example

Executing the example requires a form containing the components:

  1. TabSheetBox with the TabSheetBox1 identifier.

  2. UiReport with the UiReport1 identifier that is a data source for TabSheetBox1. UiReport1 must also be active and contain a loaded regular report with shapes on an active sheet.

The specified procedure must be assigned by handler of the OnAfterObjectChange event for the TabSheetBox1 component.

Sub TabSheetBox1OnBeforeObjectChange(Sender: Object; Args: ITabObjectChangeEventArgs);
Var
    Rect: ITabBeforeObjectRectChangeEventArgs;
    Angle: ITabBeforeObjectAngleChangeEventArgs;
    RectPos: IGxRectF;
Begin
    Select Case Args.Type
        // If object is rotated more than 90 degrees, cancel rotation
        Case TabObjectChangeType.Angle:
            Angle := Args As ITabBeforeObjectAngleChangeEventArgs;
            If Angle.NewValue > 90 Then
                Angle.Cancel := True;
            End If;
        // If object's bottom border is moved lower than 100 pixels, cancel moving 
        Case TabObjectChangeType.Rect:
            Rect := Args As ITabBeforeObjectRectChangeEventArgs;
            RectPos := Rect.NewValue;
            If RectPos.Bottom > 100 Then
                Rect.Cancel := True;
            End If;
    End Select;
End Sub TabSheetBox1OnBeforeObjectChange;

After executing the example rotation more than 90 degrees and moving of the bottom border lower than 100 pixels is canceled for all the shapes on the sheet .

See also:

TabSheetBox