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

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
         m_ImgList.GetSelectedItems(pItems);

         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);
      }
   }