DADiSP Worksheet Functions > Function Categories > Annotation > FINDSHAPE

 

FINDSHAPE

Purpose:

Finds shape handles based on property values.

Syntax:

FINDSHAPE(

win1, ..., winN, "property1", value1, …, "propertyN", valueN)

winN

-

Optional. The target windows that contains the graphic objects. Defaults to the entire worksheet.

"propertyN"

-

Optional. A string, one or more property names to identify the graphics handle.

valueN

-

Optional. An integer, string, real or series value associated with the preceding property name.

Returns:

A series of shape handles (ellipses, lines, polygons or rectangles) that match the property name/value pairs.

Example:

h = findshape(W1)

 

returns an array of handles to all shape objects in W1. The array is empty if no shape objects exist in the window.

Example:

h = findshape(W1, "color", lred)

h.color = yellow;

 

Returns an array of handles to all shape objects in W1 with a border color of light red and sets the border color of those shapes to yellow.

Example:

h = findshape(W1, W2, "color", lred, "shape", "ellipse")

h.fill = lgreen;

 

Returns an array of handles to all ellipse objects in W1 and W2 with a border color of light red and sets the interior color of those objects to light green.

Example:

W1: gsin(100, 1/100);

h1 = linedraw(W1, 0.0,  0.0,  1.0,  1.0);h1.tag = "t1";

h2 = rectdraw(W1, 0.2, -1.2,  0.8, -0.5);h2.tag = "t2";

 

h3 = findshape(W1, "tag", "t1");

h4 = findshape(W1, "tag", "t2");

 

h3[1] == h1;

h3[1].shape == "Lines";

 

h4[1] == h2;

h4[1].shape == "Rectangle"

 

Returns the shape handles based on the tag string property and displays the shape type strings. The returned handles are one element series.

Remarks:

FINDSHAPE is limited to locating shape objects. See FINDTEXT to locate text objects and FINDHANDLE to locate all graphic objects.

 

Any combination of "property name" / values can be used to located shape objects. Below is a partial list of property names:

 

Name

Type

Description

x

real

x coordinate

y

real

y coordinate

tag

string

object identifier

xor

integer

xor background flag

fill

integer

background color

lock

integer

lock interactive movement

type

string

type of object, "shape" or "text"

color

integer

border color or text color

focus

integer

target overlay focus

match

integer

overplot number to match color

shape

string

readonly type of shape, "ellipse", "line", "polygon", "rectangle", "text"

style

integer

border line style

width

integer

border width

coords

series

object coordinates as a series

handle

integer

object handle

tagnum

integer

same as object handle

target

integer

object coordinate target, glass, paper, etc.

winnum

integer

readonly window number of object target

showtag

integer

show object string tag

visible

integer

object visibility

position

series

readonly bounding box coordinates of the object in window coordinates, lower left x coordinate, y coordinate, height and width

devposition

series

readonly bounding box coordinates of the object in device coordinates

 

Specific properties can be set and queried using the handle.property dot syntax.

 

See ARROWDRAW to draw an arrow line.

 

See ELLIPSEDRAW to draw an ellipse.

 

See LINEDRAW to draw one or more line segments.

 

See POLYGONDRAW to draw a closed polygon.

 

See RECTDRAW to draw a rectangle.

 

See TEXT to draw text.

See Also:

ARROWDRAW

ELLIPSEDRAW

FINDHANDLE

FINDTEXT

ISHANDLE

LINEDRAW

POLYGONDRAW

RECTDRAW

TEXT