Shell+ 2.2b release comments

This release added several new components for namespace extensions developers and some new features to general shell extension components:

Adding menu items to Explorer's menu

Since this version you can add custom and common menu items to Explorer's main menu. The most common usage of this feature is adding your menu items to the View menu. As usual it's easy to implement: you will put TSxExplorerMenu component to your main SxModule and connect it to ShellView component:

After you have to specify the list of menu items and their locations in Explorer menu. TSxExplorerMenu component provides several properties: File, Edit, View and so on. Each property corresponds to appropriate menu item in the Explorer's main menu. You can add any number of items.

Each item contain a link to the TMenuItem object. You can use any menu component to store your menu items. This component can be located at the ShellViewForm (if you use TSxFormShellView) or at the PermanentModule.

Also each item contain NoFocusBehaviour property. It controls item state depending on ShellView focused state. You can disable or hide item, when ShellView not focused.

Adding buttons to the Explorer's toolbar

Another common task for NSE developers is adding custom buttons to the Explorer's toolbar. Development process is similar to adding menu items to the Explorer's menu. You have to put the TSxExplorerToolbar component on the main SxModule and connect it to the ShellView component:

TSxExplorerToolbar component have only one property to specify the list of buttons. It's a Buttons property. For each button have to specify the MenuItem link, style, image and tooltip information. Unfortunately in 2.2b version you cannot add your own image to the toolbar, but we hope to get rid of this problem in the next version. MenuItemLink property used as like as the same property for TSxExplorerMenu component.


New common verbs: Rename and Delete

Rename and Delete are common verbs for items in the Windows Shell. Generally you will only implement appropriate event handlers for DataProvider component. But in some cases you can override behaviour of these items.

Since this version added two event for supporting Rename verb: OnQueryRenameGrain and OnRenameDataGrain. Using OnQueryRenameGrain event you can deny or allow displaying of 'Rename' menu item in the context menu for specified DataGrain. OnRenameDataGrain called when used has performed renaming specified DataGrain. In this event handler you will assign new name for your DataGrain or modify record in your database:

procedure TFormPermanentModule.SxSimpleTreeProviderRenameDataGrain(
  Sender: TSxCustomProvider; ParentGrain, DataGrain: TSxCustomDataGrain;
  var NewName: WideString; var PerformRename: Boolean);
                   LocatePermanentGrain(TSxSimpleTreeDataGrain(DataGrain).GUID); permanentGrain.Name:=NewName; PerformRename:=True; end;

To deny or allow displaying of 'Delete' verb you can handle OnQueryDeleteGrain. To handle delete operations you will implement OnHandleDelete event:

procedure TPermanentModule.SxSimpleTreeProviderHandleDelete(
  Sender: TSxCustomProvider; DataGrain: TSxCustomDataGrain);


Local and global Windows Shell notifications

This version of Shell+ handles Shell Notifications. This means that all your NSE's windows will be updated automatically when any operation takes place (new file, create, delete etc.)

There are two kinds of Shell Notifications: Local and Global. Local notifications handled only inside the current Explorer instance, but they does not lock your DLL and this helps you to debug your namespace extension. Global notifications working across all Explorer instances, but to make it possible, your NSE's DLL will be loaded to global Explorer instance and will be unloaded only with Windows shutdown.

You can specify required notification kind using ShellView.ChangeNotifyType property.


New events for shell and Namespace extension components

Since last versions we've added several new events for DataProvider and other Shell extension components. New Provider events described in updated article "Writing data handling events for DataProvider". Other new events described in this article:

  •  OnGetShellView event - specify custom ShellView for any folder in your namespace
  •  OnSortColumn and OnSort events - allow you to perform custom sorting by different columns
  •  Extended PropertySheet events
  •  OnViewStyleChange - occurs when user changed view style of current window
  •  OnSelectionChanged - occurs when SelectedGrain and SelectedGrainList properties were changed

    OnGetShellView event exposed by TSxShellFolder component successors. You can specify different views for any of your folder grains. Just set any of your ShellViews to NewShellView parameter.

    OnSortColumn event exposed by TSxNamespaceDetails component. You receive two DataGrains as parameter and reference to column to compare. You will compare these DataGrains and return result using Result parameter. Use table below to make a result value.

    OnSort event exposed by TSxNamespaceColumn class. As like to OnSortColumn event you will receive two DataGrains and return result using Result parameter. Use the following table to make a result value:

DataGrain1 = DataGrain2
= 0
DataGrain1 > DataGrain2
> 0
DataGrain1 < DataGrain2
< 0

Extended PropertySheet events - since this version in addition to existent events to TsxShellPropSheetExt component were implemented several new events: OnApplyEx, OnKillActiveEx, OnSetActiveEx and OnQueryCancelEx. The only difference from previous analogues - additional parameters, that makes handling of these events more ease.

OnViewStyleChange event exposed by TSxShellViewForm component. It is occurs when user changed current view style (List, Large Icons etc.)

procedure TExampleShellViewForm.SxShellViewFormViewStyleChange(
  Sender: TSxShellViewForm);
  case ViewStyle of
    svsIcon:        begin
    svsSmallIcon:   begin
    svsDetails:     begin
    svsList:        begin

OnSelectionChanged event exposed by TSxShellViewForm and occurs when properties SelectedDataGrain and SelectedGrainsList was changed. These properties modified automatically by TSxShellListControl component or you can control them manually.


Common columns support for TSxColumnProvider component

Since Windows 2000 you can specify different text properties for any file on your disks. This properties can be displayed as additional columns for each folder:

On this picture the "Title" column contains data from first line of approciate file.

You can map your data to one of common columns using TShellColumn.ColumnLink property.


Code examples for this article

ShellViewForm example demonstrates, how to implement:

     NSE contents with TSxSimpleTreeProvider component
     Flexible custom ShellView using TSxShellFormView component
     Clipboard operations
     Drag'n'Drop operations to and from namespace extension
     Accessing your namespace extension from Common Dialogs
     Adding property sheets to the root and data grains of your NSE
     Addign own menu items to Explorer's menu
     Addign button to Explorer's toolbar


End of article.Go top
Last update December 23, 2011