wpFindUseItem
Appearance
This instance method is called to retrieve an item type from the object's in-use list.
Syntax
_wpFindUseItem(somSelf, type, pCurrentItem)
Parameters
- somSelf (WPObject *) - input
- Pointer to the object on which the method is being invoked.
- Points to an object of class WPObject.
- type (ULONG) - input
- Specify the usage type of the item to be located.
- pCurrentItem (PUSEITEM) - input
- Pointer to a USEITEM structure.
- NULL: Retrieve the first item in the in-use list that has a usage type of type.
- Other: Retrieve the next item in the in-use list, following the item specified by pCurrentItem, that has a usage type of type.
Returns
- rc (PUSEITEM) - returns
- Success indicator.
- NULL: No items matching the specified find criteria were found in the in-use list for this object.
- Other: A pointer to a USEITEM structure that matches the specified find criteria.
Remarks
This method will search the object's in-use list for all items that were added by previous calls to the wpAddToObjUseList method.
Usage
This method should be called to determine how the object is currently being used, for example, which views are currently open and what container window the object is inserted into.
How to Override
This method is generally not overridden.
Example Code
In this example, when the last view of a MYFOLDER object is closed, we zero out its first view instance variable, so that the next time it has a first view opened, we can keep track of that.
SOM_Scope BOOL SOMLINK myfold_wpDeleteFromObjUseList(MYFOLDER *somSelf, PUSEITEM pUseItem ) { MYFOLDERData *somThis = MYFOLDERGetData(somSelf); PUSEITEM pItem; BOOL rcParentCall; MYFOLDERMethodDebug("MYFOLDER","myfold_wpDeleteFromObjUseList"); /* Call parent's method first */ rcParentCall = parent_wpDeleteFromObjUseList(somSelf, pUseItem); pItem = _wpFindUseItem(somSelf, USAGE_OPENVIEW, NULL); if (!pItem) { _setFirstViewHandle(somSelf, NULLHANDLE); } /* endif */ return( rcParentCall ); }