CImage:AttachFromList


The AttachFromList method lists all images in a specified image window and returns the selected image as a new CImage object. This method opens a window like the one shown below. After selecting an image, click [OK] to return the CImage to the script.

 

Syntax

Object = CImage:AttachFromList( CImageView )

where

    CImageView is the CImageView object containing the images to be listed.

    Object is a new CImage attached to the selected image.

    On success, this method returns a reference to the new CImage object, otherwise nil.

  

This method is used to create a CImage attached to an image chosen from a list. When this method is called, the script creates a window similar to a GetItem dialog with the drop box populated with the titles of the images in the specified CImageView window. To attach one of the images to the script, select an item and click [OK]. This method creates the CImageView, so the new constructor should not be used before calling this method.

Example

This script below first creates a CImageView from the image window you select, then lists the images in the selected window. After you select an image from that list, the target image is displayed in a new window:

V = CImageView:AttachFromList()

-- select the CImageView from a list

Assert( V, "No Image views are open")

-- check that the CImageView is valid

if ( V:Count() > 1 ) then

  

  I = CImage:AttachFromList( V )

-- now pick the image from the CImageView V

  Assert( I, "No Images are available")

 

else

 

  I = V:GetImage()

-- pick the only image in the window

end

 

Related Topics

Attach

new

CImageView:CAttachFromList

CImage class