CLabels:Attach


The Attach method associates a CImageView object with an existing CLabels object. This method automatically opens the Labeling toolbar in the image window attached to the CImageView.

Syntax

bSuccess = CLabels:Attach( CImageView )

where

    CImageView refers to the image window where labels will be drawn.

     bSuccess is the returned success code. On success it is true, otherwise false.

 

The target CImageView can be specified in the new constructor for the CLabels object. If you use a constructor that does not specify the CImageView, then you must use the Attach method before labels can be drawn on an image. The Attach method may also be used to switch labeling action between CImageView windows without instantiating new CLabel objects.

Example

Suppose a CImageView V exists and displays 1 or more images. The following script uses the "new + Attach" method to draw a label on an image:

L = CLabels:new()

-- create a new CLabels L

x = 192 ; y = 390

-- target coordinates

str = "My label text"

-- label coordinates

L:Attach( V )

-- attach to the CImageView V

I = V:GetImage()

-- I is the current displayed image in V

Related Topics

Add

CLabels class