LImageListControl::Update

#include "ltwrappr.h"

L_INT LImageListControl::Update(pItem, nIndex)

pLILITEM pItem;

/* pointer to a pItem structure */

L_INT nIndex;

/* index of the item to update */

Updates the specified item in the ImageList Control.

Parameter

Description

pItem

Pointer to an LILITEM structure that contains new attributes for the item at the specified index.

nIndex

0-based index that indicates which item to update.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The LILITEM structure pointed to by pItem specifies the information to with which to update the specified item. The uMask member of the LILITEM structure indicates the attributes of the item to update.

Note: When you update an item, the image and text (if any) are copied to internal storage. The ImageList Control will free its copy of the image and/or text when the item is deleted. You are responsible for freeing the original data when it is no longer needed by your application.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LImageListControl::ExportBitmapList, LImageListControl::ImportBitmapList, LImageListControl::SortExt. Class Members

Topics:

Using the ImageList Control

Example

L_INT LImageListControl__UpdateExample(LImageListControl& ImgList)
{
   L_INT nRet;
   LILITEM Item;
   LBitmapBase Bitmap;
   // get the item's image
   Item.uStructSize = sizeof(LILITEM);
   Item.uMask = LILITEM_BITMAP;
   nRet = ImgList.GetItem(&Item, 0);// get first item
   if(nRet != SUCCESS)
      return nRet;
   // flip the image
   Bitmap.SetHandle(Item.pBitmap);
   nRet = Bitmap.Flip();
   if(nRet != SUCCESS)
      return nRet;
   Item.pBitmap = Bitmap.GetHandle();
   // change the item's image and text
   Item.pText = TEXT("Flipped Image");
   Item.uMask = LILITEM_BITMAP | LILITEM_TEXT ;
   nRet = ImgList.Update(&Item, 0);// update the item
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}