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.
bSuccess = CLabels:Attach( CImageView ) |
CImageView refers to the image window where labels will be drawn.
On success, true is returned.
If the attachment fails or CImageView is nil, then false is returned.
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.
Suppose a CImageView V exists and displays 1 or more images. The following script fragment 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 |