shellproperties TdcShellProperties component
Properties Methods Events
Return to Introduction  Previous page  Next page
Overview
The TdcShellProperties component used to show the "Properties" dialog box or context menu for the shell objects (file, folder or disk).  

How to use ?
Just specify the name of shell object in the FileName property (this can be file, folder or even disk), and call ShowContextMenu method to display the context-menu from current mouse position, or ShowProperties to display the "Properties" dialog box.  
 
You can also perform the same operations without specifying the FileName property - just call the ShowContextMenuByFile and ShowPropertiesByFile methods and specify the name of shell objects as method parameter.  
 
new! The dcShellProperties component, of the DiskControls v3.0 and later, supports number advanced options which controls the behavior of the context menu. You can show or hide some groups of menu items in the context menu; allow or disallow operations assocated with menu items. See MenuOptions property and list of events for more details.  

Example 1 (following line shows the properties of "c:\autoexec.bat" file):
dcShellProperties1.ShowPropertiesByFile('c:\autoexec.bat');  
 
Example 2 (demostrates how to work with shell context menu)
procedure TForm1.ListView1MouseDown(Sender: TObject;  
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);  
var  
  ListItem: TListItem;  
begin  
  if Button = mbRight then  
   begin  
    ListItem := ListView1.GetItemAt(X, Y);  
    if ListItem <> nil then  
     begin  
      SetFocus;  
      ListItem.Selected := True;  
 
      with dcShellProperties1 do  
       begin  
        if ListView1.ReadOnly then  
          MenuOptions := MenuOptions - [moCanRename]  
        else  
          MenuOptions := MenuOptions + [moCanRename];  
 
        ShowContextMenuByFile(ListItem.Caption);  
       end;  
     end;  
   end;  
end;  
 
procedure TForm1.dcShellProperties1Rename(Sender: TObject;  
  FileName: String);  
begin  
  if ListView1.Selected <> nil then   
    ListView1.Selected.EditCaption;  
end;  
sIU/QH/K+!