wpInitIconPosData
This method is specific to Version 4, or higher, of the OS/2 operating system.
This instance method reads the .ICONPOS extended attribute (EA) for the folder directory to determine where to position the object icons within the folder.
Syntax
_wpInitIconPosData(somSelf)
Parameters
- somSelf (WPFolder *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPFolder.
Returns
- rc (BOOL) - returns
- Success indicator
- TRUE Successful completion.
- FALSE Error occurred.
How to Override
This method is not generally overridden.
Usage
You can call the **wpInitIconPosData** method at any time to initialize an internal data structure with information about the positions of all icons in an Icon View of a folder.
Example Code
#define INCL_WINWORKPLACE #include <os2.h> WPFolder *somSelf; /* Pointer to the object on which the method is being invoked. */ BOOL rc; /* Success indicator */ rc = _wpInitIconPosData(somSelf);
Remarks
This method allocates memory, and that memory should be freed using the wpFreeIconPosData method.
Example Code
This example shows how you can use the **wpInitIconPosData**, wpIdentify, wpQueryIconPosition, and wpFreeIconPosData methods to find the icon position information for all objects within a folder. In this example, **somSelf** contains the pointer to the folder being examined.
BOOL bSem;
WPObject *Object;
CHAR szIdentity[CCHMAXSTRING];
POINTL ptl;
ULONG ulIndex;
/* Retrieve the icon position information for all objects within the
* folder */
_wpInitIconPosData(somSelf);
/* Find the every object within the folder */
bSem = !_wpRequestObjectMutexSem(somSelf,SEM_INDEFINITE_WAIT);
for (Object = _wpQueryContent(somSelf,NULL,QC_FIRST);
Object;
Object = _wpQueryContent(somSelf,Object,QC_NEXT));
{
/* For each object in the folder, find the position of its icon
* in an Icon View of the folder */
if (_wpIdentify(Object,szIdentity))
{
if (_wpQueryIconPosition(somSelf,szIdentity,&ptl,&ulIndex))
{
/***** ptl contains the position of the icon for this object *****/
}
}
}
if (bSem)
{
_wpReleaseObjectMutexSem(somSelf);
}
/* Free the icon position data structure */
_wpFreeIconPosData(somSelf);