LImageListControl::Insert

#include "ltwrappr.h"

L_INT LImageListControl::Insert(pItem, nIndex=-1)

pLILITEM pItem;

pointer to the item to insert */

L_INT nIndex;

/* index at which to insert the item */

Inserts an item into the ImageList Control.

Parameter

Description

pItem

Pointer to an LILITEM structure containing the item to be inserted.

nIndex

0-based index at which to insert the item. Pass -1 to insert item at the end of the list.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

All items beyond the specified index are pushed up by one.

Note: On an insert, 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.

See Also

Functions:

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

Topics:

Using the ImageList Control

Example

LImageListControl m_ImgList;

LILITEM Item;
LBitmapBase Bitmap;

Bitmap.Load(TEXT("v:\\images\\babe.cmp"));

Item.uStructSize = sizeof(LILITEM);
Item.pBitmap = Bitmap.GetHandle();
Item.pText = TEXT("v:\\images\\babe.cmp");
Item.lData = 0;
Item.bSelected = TRUE;
Item.uMask = LILITEM_BITMAP |
LILITEM_TEXT |
LILITEM_DATA |
LILITEM_SELECTED;

m_ImgList.Insert(&Item);// at end of list
int nItem = m_ImgList.GetItemCount()-1;
// make it visible
m_ImgList.EnsureVisible(nItem);