Jump to content

wpFreeCellData

From EDM2
Revision as of 01:44, 17 November 2025 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:wpFreeCellData}} This method is specific to Version 4, or higher, of the OS/2 operating system. This instance method frees the data for the specified cell. ==Syntax== _wpFreeCellData(somSelf, pCell, ulIndex) ==Parameters== ;''somSelf'' (WPPalette *) - input :Pointer to the object on which the method is being invoked. :Points to an object of class WPPalette. ;''pCell'' (PCELL) - input :Pointer to the cell. ;''ulIndex'' (ULONG) - input...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This method is specific to Version 4, or higher, of the OS/2 operating system.

This instance method frees the data for the specified cell.

Syntax

_wpFreeCellData(somSelf, pCell, ulIndex)

Parameters

somSelf (WPPalette *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPPalette.
pCell (PCELL) - input
Pointer to the cell.
ulIndex (ULONG) - input
The number of the cell (**0** to **xCellCount** \* **yCellCount-1**).

Returns

rc (BOOL) - returns
Success indicator
TRUE Successful completion.
FALSE Error occurred.

How to Override

This method must be overridden in any subclass of **WPPalette** that allocates storage associated with a palette cell. This method should be overridden by all subclasses that wish to save and restore part of their cell data. For example, the scheme palette will save the name of the background bitmap for the scheme.

Usage

This method is called by the wpUninitData method for each cell in a palette that is being made dormant. The **wpFreeCellData** method is responsible for freeing any storage allocated for the cell. This method should be called after calling wpSaveCellData and wpRestoreCellData to free the memory used by wpSaveCellData.

Example Code

#define INCL_WINWORKPLACE
#include <os2.h>

WPPalette *somSelf; /* Pointer to the object on which the method is being invoked. */
PCELL *pCell; /* Pointer to the cell. */
ULONG ulIndex; /* The number of the cell (0 to xCellCount * yCellCount-1). */
BOOL rc; /* Success indicator */

rc = _wpFreeCellData(somSelf, pCell, ulIndex);

Example Code

In this example, the Scheme Palette has allocated three strings that are pointed to by its **CELL** data structure. The **wpFreeCellData** method frees these strings before allowing **WPPalette** to free the data structure itself.

SOM_Scope BOOL SOMLINK sch_wpFreeCellData(WPSchemePalette *self,
             PCELL pCell, ULONG ulIndex)
{

   /* Free the strings associated with the cell  */
   FreeMem((PBYTE)(((PSCHEME)pCell)->pszAppName));
   FreeMem((PBYTE)(((PSCHEME)pCell)->SaveFolderBackground.pszImageFile));
   FreeMem((PBYTE)(((PSCHEME)pCell)->SaveDesktopBackground.pszImageFile));

   /* Free the cell information  */
   return (parent_wpFreeCellData(self,pCell,ulIndex));
}

Related Methods