wpQueryContent
Appearance
This instance method is called to allow the folder to specify its contents.
Syntax
_wpQueryContent(somSelf, Object, ulOption)
Parameters
- somSelf (WPFolder *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPFolder.
- Object (WPObject *) - input
- Pointer to a workplace object. This field is ignored unless QC_NEXT is specified in ulOption.
- ulOption (ULONG) - input
- Flag indicating the object to query (QC_FIRST, QC_NEXT,QC_LAST).
Returns
- item (WPObject *) - returns
- Pointer to the correct item in the folder's content list.
Remarks
This method allows the user to query the folder's content in various ways using the ulOption flag. QC_FIRST returns the first item in the content list, QC_LAST returns the last item, and QC_NEXT returns the next item after 'Object' in the list.
Usage
This method is generally called to look for a specific object or to query the contents in a specific folder.
How to Override
This method is generally not overridden.
Example Code
SOM_Scope HWND SOMLINK myfold_wpOpen(MYFOLDER *somSelf, HWND hwndCnr, ULONG ulView, ULONG param) { HWND hwndFromParentOpen = NULLHANDLE; MYFOLDERData *somThis = MYFOLDERGetData(somSelf); MYFOLDERMethodDebug("MYFOLDER","myfold_wpOpen"); if (_queryFirstViewHandle(somSelf) == NULLHANDLE) { /* ONLY do this on FIRST open of the folder. */ if (_wpPopulate(somSelf, NULLHANDLE, NULL, FALSE)) { WPObject *Obj; WPObject *LastFoundObj = NULL; /* Check contents of folder and see which are instances of * WPFolder, we'll delete any WPFolders as a cleanup step */ for ( Obj = _wpQueryContent(somSelf,NULL,(ULONG)QC_First); Obj; Obj = _wpQueryContent(somSelf, Obj, (ULONG) QC_Next )) { /* delete the last object found on the previous iteration * of the loop (we couldn't delete it then, because we * needed it at the top of the loop for this iteration) */ if (LastFoundObj) { _wpDelete(LastFoundObj,0); LastFoundObj = NULL; } /* endif */ /* we want to make sure that all previously * existing folders are deleted */ if (_somIsA(Obj, _WPFolder)) { LastFoundObj = Obj; } /* endif */ } /* endfor */ /* if there is still one object left to delete, do it now */ if (LastFoundObj) { _wpDelete(LastFoundObj,0); LastFoundObj = NULL; } /* endif */ } /* end if populate */ } /* end if first open */ /* Show the opened folder */ hwndFromParentOpen = parent_wpOpen(somSelf, hwndCnr, ulView, param); /* If this is the first open, set our global flag */ if (_queryFirstViewHandle(somSelf) == NULLHANDLE) { _setFirstViewHandle(somSelf, hwndFromParentOpen); } /* endif */ return( hwndFromParentOpen ); }
This example code shows how to call wpQueryContent.
cbIconSize = _wpQueryIconData(Object,NULL); pIconSize = (PICONINFO)_wpAllocMem(Object,cbIconSize,NULL); if (pIconInfo != NULL) { _wpQueryIconData(Object,pIconInfo); }