LImageListControl::Insert

Summary

Inserts an item into the ImageList Control.

Syntax

#include "ltwrappr.h"

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

Parameters

pLILITEM pItem

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

L_INT nIndex

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

Returns

Value Meaning
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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LImageListControl__InsertExample(HWND hParent) 
{ 
   L_INT nRet; 
   LImageListControl m_ImgList; 
   LILITEM Item; 
   LBitmapBase Bitmap; 
 
   if(m_ImgList.CreateControl(hParent,0) == NULL) 
      return FAILURE; 
 
   nRet = Bitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP"))); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   Item.uStructSize = sizeof(LILITEM); 
   Item.pBitmap = Bitmap.GetHandle(); 
   Item.pText = MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")); 
   Item.lData = 0; 
   Item.bSelected = TRUE; 
   Item.uMask = LILITEM_BITMAP | LILITEM_TEXT | LILITEM_DATA | LILITEM_SELECTED; 
 
   nRet = m_ImgList.Insert(&Item);// at end of list 
   if(nRet != SUCCESS) 
      return nRet; 
 
   L_INT nItem = m_ImgList.GetItemCount()-1; 
   // make it visible 
   nRet = m_ImgList.EnsureVisible(nItem); 
   if(nRet == 0) 
      return FAILURE; 
 
   return SUCCESS; 
} 
Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.