Populating Your Folders

You will need to add items to the folders in your namespace. This is done through the GetFirstId / GetNextId function pair. These functions are used in enumerating the items of your namespace folders. The functions have a Cookie parameter that let you keep track of your position in the enumeration.

Suppose for example you just want to add 10 items to your folder. To do this, add the following example code to the implementation of GetFirstId:

pData := TMyNamespaceItem.Create(Data);
Cookie := 1;
Result := true;

And add the following code to the implementation of GetNextId:

pData := TMyNamespaceItem.Create(Data);
Cookie := Cookie + 1;
if Cookie < 10 then
Result := true;
else
Result := false;

The functions GetFirstId and GetNextId have to check their flags to see which objects have to be enumerated or not. You will typically have enumerations asking only for subfolders of the current folder in your namespace (for display in the Explorer tree view) and enumerations asking for all items of the current folder in your namespace (for display in the Explorer list view).


HTML generated by Time2HELP
http://www.time2help.com