CImageSet:GetImage CImageSet:new

CImageSet:Insert


The Insert method adds a CImage to the image set prior to a specified index. For example, to add an image at the beginning of the set, before all other members, insert at position 1. A reference to the existing CImage is saved into the image set; no memory is allocated for a new image.

Syntax

CImageSet:Insert( CImage, index )

bullet.gif    CImage is the image object to insert.

bullet.gif    index is a number that specifies the insertion point, beginning at 1.

Remarks

The CImage is inserted prior to the image set member existing at position index. This moves all the members down in the list in order to open up the new position at index. A reference to the target CImage is then saved at the new position.

Example

Suppose a CImageSet exists with name S and that it contains 10 images. The following script inserts a CImage I at index 5:

 

I = new_image()

-- create a CImage

sPath, bOk = GetFileName()

-- use the Open dialog to get a filename

if not bOk then Exit() end

-- exit the loop after canceling the Open dialog

  I:Open(sPath)

-- load the image

  S:Insert( I, 5 )

-- Insert the new member at position 5

end

 

Printf("Count=%d", S:Count() )

-- result: Count=11

Related Topics

CImageSet class, CImage class


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