setImageList

>>--setImageList(--newImageList--)---------------------------------------------><

Assigns, or removes, an image list for the tab control. Using .nil for the first argument removes the current image list. Each tab can have an icon associated with it, which is specified by an index in the image list for the tab control.

Destroying a tab control does not destroy an image list that is associated with it. The programmer must destroy the image list separately, if desired. This is useful if the programmer wants to assign the same image list to multiple tab controls. In essence, the ownership of the image list remains with the programmer. The ImageList and Image classes are used to manage image lists and images in ooDialog. The documentation on both classes discusses when and why the programmer may want to release image lists. The Image class documentation has the most detail on this subject.

Details

Raises syntax errors when incorrect arguments are detected.

Arguments:

The single required argument is

newImageList

The image list to assign to the tab control. If this argument is .nil the existing image list, if any, is removed.

Return value:

The existing image list is returned, if there is one. Otherwise, .nil is returned.

Example:

This example creates an image list from a bitmap file that is a series of 16x16 bitmaps, each one a colored letter. The image list is then assigned to the tab control.


  -- Add all the tabs, including the index into the image list for an icon for
  -- each tab.
  tc~AddFullSeq("Red", 0, ,"Green", 1, , "Moss", 2, , "Blue", 3, , "Purple", 4, , -
                "Cyan", 5, , "Gray", 6)

  -- Create a COLORREF (pure white) and load our bitmap.  The bitmap is a
  -- series of 16x16 images, each one a colored letter.
  cRef = .Image~colorRef(255, 255, 255)
  image = .Image~getImage("bmp\psdemoTab.bmp")

  -- Create our image list, as a masked image list.
  flags = .DlgUtil~or(.Image~toID(ILC_COLOR24), .Image~toID(ILC_MASK))
  imageList = .ImageList~create(.Size~new(16, 16), flags, 10, 0)

  if \image~isNull,  \imageList~isNull then do
     imageList~addMasked(image, cRef)
     tc~setImageList(imageList)

     -- The image list makes a copy of each image added to it.  So, we can now
     -- release the original image to free up some small amount of system
     -- resoureces.
     image~release
  end
  else do
     -- do some type of error handling
  end