CImageView:Insert


The Insert method inserts a CImage into the list of images in a CImageView. The image is inserted before the specified index.

Syntax

bResult = CImageView:Insert( CImage, nIndex )

bullet.gif    CImage is the image to insert.

bullet.gif    nIndex is the index of the insertion point, in the range 1 to Count.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, this method returns false.

Remarks

The CImageView refers to a Mira image display window. The Image window uses an image set to display multiple images. This method inserts the CImage into the image set before the specified index. For example,nIndex=1 inserts the CImage before the first member of the image set.

This method fails if nIndex is out of bounds.

Example

The following script attaches an image window from the desktop and inserts an image the image set at index 3 (that is, before the image at index 3). In this example, the window initially contains 4 images:

-- suppose CImage I exists

 

V = attachlist_imageview()

-- attach an image window from the desktop

Printf("image count = %d\n", V:Count())

-- result: image count = 4

if V:Count >= 3 then

-- create a CImage

  bOk = V:Insert( I, 3 )

-- insert the CImage before image 3

  if not bOK then break end

-- break out of the for loop if too few images

end

 

Printf("image count = %d\n", V:Count())

-- result: image count = 5

Related Topics

CImageView, Display, Append, CImage class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.