ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
Jam.Shell.Controls.Types.TOnBeforeCommand

The OnBeforeCommand event is fired before a command (usually a context menu command) is executed.

Syntax
Pascal
TOnBeforeCommand = procedure (Sender: TObject; var pCommandArgs: TBeforeCommandEventArgs) of object;
Parameters 
Description 
Sender 
The sender that processes the event. 
pCommandArgs 
A TBeforeCommandEventArgs record, that holds details on the command. 
//using the new BeforeCommand event
procedure TMainForm.ShellListBeforeCommand(Sender: TObject; var pCommandArgs:
    TBeforeCommandEventArgs);
begin
  //always open folder internally, instead of opening a File Explorer instance.
  if (pCommandArgs.Command = TShellAction.saOpen) and (pCommandArgs.CommandSource = TCommandSource.ContextMenu)
    and (pCommandArgs.Items.Count = 1) and (pCommandArgs.Items[0].IsFolder) then
  begin
    pCommandArgs.Cancel := true;
    ShellList.FolderIdList := pCommandArgs.Items[0];
  end;
end;