LImageViewer::GetCellPosition

#include "ltwrappr.h"

L_INT LImageViewer::GetCellPosition (nCellIndex, puRow, puCol, uFlags);

L_INT nCellIndex;

/* index of a cell */

L_UINT * puRow;

/* pointer to a variable to be updated */

L_UINT * puCol;

/* pointer to a variable to be updated */

L_UINT uFlags;

/* reserved for future use */

Retrieves the column and row number for the cell with the specified index.

Parameter

Description

nCellIndex

A zero-based index of the cell for which to get the position.

puRow

Pointer to a variable to be updated with the vertical position (row) of the specified cell. Row numbering starts with 1.

puCol

Pointer to a variable to be updated with the horizontal position (column) of the specified cell. Column numbering starts with 1.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. To get extended error information, call GetLastError, and refer to Return Codes.

Comments

The row and column numbers obtained by this function are relative to the first cell in the container.

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:

LImageViewer::Create, LImageViewer::RemoveCell, LImageViewer::InsertCell, LImageViewer::GetCellCount, LImageViewer::GetCellWindowHandle, LImageViewerCell::SetCellBitmapList, LImageViewerCell::SetCellTag, LImageViewerCell::SetCellProperties, LImageViewerCell::GetCellProperties, LImageViewer::RepositionCell, LImageViewerCell::GetCellBitmapList, LImageViewer::GetCellBounds, LImageViewerCell::FreezeCell, LImageViewerCell::SelectCell, LImageViewerCell::IsCellSelected, LImageViewerCell::IsCellFrozen, Class Members

Topics:

Image Viewer Cells

 

Window Control/Image Viewer Functions: Image Viewer Cells

Example

This function scrolls down or up in order to make the cell become visible.

#if defined LTV17_CONFIG
L_INT LImageViewer_GetCellPositionExample(LImageViewer& ImageViewer) 
{
   L_INT    nCellIndex = 0 ; 
   L_INT    nCount; 
   L_UINT   uRow; 
   L_UINT   uCol; 
   L_UINT   nRet; 
   DISPCONTAINERPROPERTIES DispContainerProp; 
   // Get Cells Count
   nCount = ImageViewer.GetCellCount(0); 
   if ((nCellIndex < 0) || (nCellIndex >= nCount)) 
      return FAILURE;
   // get the row count of the container
   DispContainerProp.uStructSize = sizeof(DISPCONTAINERPROPERTIES); 
   DispContainerProp.uMask = DCPF_NUMROWS; 
   nRet = ImageViewer.GetProperties(&DispContainerProp, 0); 
   if(nRet != SUCCESS)
      return nRet;
   // get the row and the col position
   nRet = ImageViewer.GetCellPosition(nCellIndex, &uRow, &uCol, 0); 
   if(nRet != SUCCESS)
      return nRet;
   nRet = ImageViewer.SetFirstVisibleRow(max(0, ((L_INT)uRow - (L_INT)DispContainerProp.uNumRows + 1)), 0); 
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
#else
L_INT LImageViewer_GetCellPositionExample(LImageViewer& ImageViewer) 
{
   L_INT    nCellIndex = 0 ; 
   L_INT    nCount; 
   L_UINT   uRow; 
   L_UINT   uCol; 
   L_UINT   nRet; 
   DISPCONTAINERPROPERTIES DispContainerProp; 
   // Get Cells Count
   nCount = ImageViewer.GetCellCount(0); 
   if ((nCellIndex < 0) || (nCellIndex >= nCount)) 
      return FAILURE;
   // get the row count of the container
   DispContainerProp.uStructSize = sizeof(DISPCONTAINERPROPERTIES); 
   DispContainerProp.uMask = DCPF_NUMROWS; 
   nRet = ImageViewer.GetProperties(&DispContainerProp, 0); 
   if(nRet != SUCCESS)
      return nRet;
   // get the row and the col position
   nRet = ImageViewer.GetCellPosition(nCellIndex, &uRow, &uCol, 0); 
   if(nRet != SUCCESS)
      return nRet;
   nRet = ImageViewer.SetFirstVisibleRow(max(0, ((L_INT)uRow - (L_INT)DispContainerProp.uNumRows + 1)), 0); 
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
#endif // LTV17_CONFIG