LImageListControl::GetSelectCount

#include "ltwrappr.h"

L_INT LImageListControl::GetSelectCount(L_VOID)

Gets the current number of selected items in the ImageList Control.

Returns

>= 0

The number of selected items.

<0

An error occurred. Refer to Return Codes.

Comments

Call this function, before calling LImageListControl::GetSelectedItems, to get the number of selected items. You can then use this number for allocating storage for the LILITEM structures.

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:

Class Members

Topics:

Using the ImageList Control

Example

L_INT LImageListControl__GetSelectCountExample()
{
   L_INT nRet;
   LImageListControl m_ImgList;
   L_INT nCount;
   // get selected count
   nCount = m_ImgList.GetSelectCount();
   if(nCount>0)
   {
      pLILITEM pItems=NULL;
      pItems = (pLILITEM)GlobalAlloc(GMEM_MOVEABLE, sizeof(LILITEM)*nCount);
      pItems->uStructSize = sizeof(LILITEM);
      pItems->uBitmapStructSize = sizeof(BITMAPHANDLE);
      if(pItems)
      {
         // get the selected items
         nRet = m_ImgList.GetSelectedItems(pItems);
         if(nRet < 0)
            return nRet;
         L_INT x;
         CString csOut;
         csOut.Format(TEXT("%ld items selected!"), nCount);
         AfxMessageBox(csOut);
         for(x=0; x<nCount; x++)
         {
            csOut.Format(TEXT("Item#%ld with text=%s"), pItems[x].lIndex, pItems[x].pText);
            AfxMessageBox(csOut);
         }
         GlobalFree(pItems);
      }
   }
   return SUCCESS;
}