ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
ShellControls.TJamShellList.OnAddItem

OnAddItem occurs, whenever a new item is added to a TJamShellList.

Syntax
Pascal
property OnAddItem: TOnAddItem;

Important: Using the OnAddItem event may slow down your applications because it is called for all items in the TJamShellList. Using the OnGetImageIndex to fill your custom columns may be better, because this event is only fired for those items that currently need to be displayed. (Of course you don't have to adjust the image index if you don't want to)

By writing an OnAddItem event handler, you can decide individually which items should be shown in the TJamShellList by changing the CanAdd variable. You can also change the appearance of the Item by modifying its properties.

The following sample event handler hides all Excel files and the floppy drive in a TJamShellList.

procedure TMainForm.ShellListAddItem(Item: TJamShellListItem; var CanAdd: Boolean);
begin
if CompareText(ExtractFileExt(ShellList.GetFullPath(Item)), '.xls')!=0 then
CanAdd := False;
CanAdd := not (GetDriveType(PChar(ShellList.GetFullPath(Item))) in [DRIVE_REMOVABLE]);
end;