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 enables the user to get information about the shape by using 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 the example requires a form, the WorkspaceBox component named WorkspaceBox1 on the form and the UiWorkspaceObject, or UiWorkspace component that is a data source for the WorkspaceBox1 component.

Add links to the Andy, ExtCtrls, Forms, Ui, and Workspace system assemblies.

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 clicking the button, if the cursor is pointed at any shape of the workspace, the "s" variable contains the identifier of this shape.

See also:

IWorkspaceBox