IWorkspaceBox.GetShapeByPt

Syntax

GetShapeByPt(Pt: IGxPoint): IWxShape;

Parameters

Pt. Coordinates of the point located within the shape, the information about which must be obtained.

Description

The GetShapeByPt method allows to get information about the shape by using the screen coordinates of the point that is located within the shape.

Comments

Coordinates of the point must be set relative to the component area. If area of the specified point does not contain a shape, the method returns Null.

Example

Executing this example requires a form with the WorkspaceBox component named WorkspaceBox1 and the UiWorkspaceObject component or the UiWorkspace component that is a data source for WorkspaceBox1.

Sub WorkspaceBox1OnMouseDown(Sender: Object; Args: IMouseClickEventArgs);
Var
    Pt: IGxPoint;
    Shape: IWxShape;
Begin
    Pt := Args.pPoint As IGxPoint;
    Shape := WorkspaceBox1.GetShapeByPt(Pt);
    If Shape <> Null Then
        s := Shape.Id;
    End If;
End Sub WorkspaceBox1OnMouseDown;

On pointing the cursor at the workspace and pressing the button after executing this example, if the cursor is pointed at any shape of the workspace, the "s" variable contains the identifier of this shape.

See also:

IWorkspaceBox