L_DispContainerRepositionCell

#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerRepositionCell(hCon, nCellIndex, nTargetIndex, bSwap, uFlags)

HDISPCONTAINER hCon;

/* handle to the container */

L_INT nCellIndex;

/* the old cell index */

L_INT nTargetIndex;

/* the new index of the cell */

L_BOOL bSwap;

/* shift or swap flag */

L_UINT uFlags;

/* reserved for future use */

Sets the position of the specified cell, based on the index of the cell.

Parameter

Description

hCon

Handle to the container.

nCellIndex

A zero-based index of the current cell position.

nTargetIndex

A zero-based index of the new cell position.

bSwap

Flag that indicates whether to perform swap on the cells specified in nCellIndex and nTargetIndex, or to shift the cells according to the parameters and then set the cell with nCellIndex, in the position of nTargetIndex.  Possible values are:

 

Value

Meaning

 

TRUE

Swap the cells.

 

FALSE

Shift the cells.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Set the bSwap flag to TRUE to swap the nCellIndex and nTargetIndex. Otherwise the function will shift the cells and then place the cell with the cell index nCellIndex in the exposed area. See the following illustration:

bSwap value when nCellIndex = 2 and nTargetIndex = 6

Cell order:1 2 3 ... 4 5 6

TRUE

1 6 3 4 5 2

FALSE

1 3 4 5 6 2

Required DLLs and Libraries

LTIVW

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:

L_DispContainerCreate, L_DispContainerRemoveCell, L_DispContainerInsertCell, L_DispContainerGetCellCount, L_DispContainerGetWindowHandle, L_DispContainerSetCellTag, L_DispContainerSetCellProperties, L_DispContainerGetCellProperties, L_DispContainerGetCellPosition, L_DispContainerGetCellBitmapList, L_DispContainerGetCellBounds, L_DispContainerFreezeCell, L_DispContainerSetBounds, L_DispContainerSelectCell, L_DispContainerIsCellSelected

Topics:

Image Viewer Cells

 

Image Viewer Functions: Image Viewer Cells

Example

This function shuffles the order of the cells

#if defined LEADTOOLS_V17_OR_LATER
 L_INT DispContainerRepositionCellExample(HDISPCONTAINER hCon) 
{
   L_INT nRet;
   L_INT nI, nCount; 
   // Get Cells Count
   nCount = L_DispContainerGetCellCount (hCon, 0);
   srand((L_INT)GetCurrentTime());
   // Shuffles all the cells
   for (nI = 0; nI < nCount; nI++)
   {
      nRet = L_DispContainerRepositionCell(hCon, nI, (rand() % nCount),TRUE, 0); 
      if(nRet != SUCCESS)
         return nRet;
   }
   
   return SUCCESS;
}
#else
 L_INT DispContainerRepositionCellExample(HDISPCONTAINER hCon) 
{
   L_INT nRet;
   L_INT nI, nCount; 
   // Get Cells Count
   nCount = L_DispContainerGetCellCount (hCon, 0);
   srand((L_INT)GetCurrentTime());
   // Shuffles all the cells
   for (nI = 0; nI < nCount; nI++)
   {
      nRet = L_DispContainerRepositionCell(hCon, nI, (rand() % nCount),TRUE, 0); 
      if(nRet != SUCCESS)
         return nRet;
   }
   
   return SUCCESS;
}
#endif