Developer

API Reference

IGridContainer_GetGridDescriptors()

Brew Release
Brew MP 1.0.2
See Also
- GridDescriptor
- IGridContainer_SetGridDescriptors()
- IGridContainer
Description
This function will fetch the GridDescriptors or the number of rows and columns for a grid container depending on how it is called (see below).
Parameters
  • p
    []:
    [in] A pointer to an IGridContainer object.
  • pRows
    []:
    [out] This parameter can be either NULL or an array of GridDescriptors with length iRows, one for each row. When this parameter is NULL, iRows becomes an "out" parameter, and it will be set to the number of rows in the grid container.
  • iRows
    []:
    [out] If pRows is NULL, this parameter will be set to the current number of rows. If pRows is not NULL i.e. contains an empty array of GridDescriptors, then this parameter should specify the length of the array.
  • pCols
    []:
    [out] This parameter can be either NULL or an array of GridDescriptors with length iCols, one for each column. When this parameter is NULL, iCols becomes an "out" parameter, and it will be set to the number of columns in the grid container.
  • iCols
    []:
    [out] If pCols is NULL, this parameter will be set to the current number of columns. If pCols is not NULL i.e. contains an empty array of GridDescriptors, then this parameter should specify the length of the array.

Prototype
   void IGridContainer_GetGridDescriptors(IGridContainer *po, GridDescriptor *pRows, uint16 *iRows,
                                          GridDescriptor *pCols, uint16 *iCols);
Return
None
Side Effect
None
Comment
Getting the number of rows and columns can be accomplished two ways: (1) use IWidget_GetProperty() with either PROP_ROWS or PROP_COLS, or (2) call IGridContainer_GetGridDescriptors(). Here's an example of how you could use IGridContainer_GetGridDescriptors() to properly get the GridDescriptors from a grid container:
   int FetchGridDescriptors(IGridContainer *picMyGrid) 
   {
      uint16 iRows, iCols;
      GridDescriptor *pRows, *pCols;
      IGridContainer_GetGridDescriptors(picMyGrid, NULL, &iRows, NULL, &iCols);
      pRows = (GridDescriptor*)MALLOC(sizeof(GridDescriptor) * iRows);
      pCols = (GridDescriptor*)MALLOC(sizeof(GridDescriptor) * iCols);
      if (!pRows || !pCols)         //check for good malloc
         return AEE_EFAILED;

      IGridContainer_GetGridDescriptors(picMyGrid, pRows, &iRows, pCols, &iCols);
      // Now, do something useful with the information 
      return AEE_SUCCESS;
   }
  • Follow