FINDHANDLE

Purpose:

Finds graphic handles based on property values.

Syntax:

FINDHANDLE(

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 object handles that match the property name/value pairs.

Example:

h = findhandle(W1)

 

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

Example:

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

h.color = yellow;

 

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

Example:

h = findhandle(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 = text(W1, 0.4,  0.5, "My Text");h1.tag = "t1";

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

 

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

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

 

h3[1] == h1;

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

 

h4[1] == h2;

h4[1].shape == "Rectangle"

 

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

Remarks:

FINDHANDLE locates both shape and text objects. See FINDSHAPE to locate shape objects only and FINDTEXT to locate text objects only.

 

Any combination of "property name" / values can be used to located graphic 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

DELETEHANDLE

ELLIPSEDRAW

FINDSHAPE

FINDTEXT

ISHANDLE

LINEDRAW

POLYGONDRAW

RECTDRAW

TEXT