Where is TShellTreeView?

2019-01-27 11:36发布

问题:

I'm trying to compile an old project in Delphi 10 Seattle and get the following error message

class TShellTreeView not found click cancel to ignore.....

TShellTreeView is a design-time component, part of the ShellCtrls package, that always shipped with Delphi in the Samples packages typically found in :

C:\Users\Public\Documents\Embarcadero\Studio\xx.x\Samples\Object Pascal\VCL\

Now it doesn't seem to be there anymore. Where did this package go?

回答1:

The ShellControls design-time package, along with a number of other very old items in the Samples package were removed in XE7+.

If you want a ready-made design-time package, you can still get the last version shipped with XE6 in the SourceForge repository here.

The relevant documentation page that links to this repository is the XE6-specific page. Documentation pages specific to later versions of Delphi will link to the new Samples repositories specific to those versions. To install the package, open the vclshlctrls.dproj file, right-click the ShellControls.bpl package in the Project Manager and select Install.

Keep in mind that this is now an abandoned package - you may need to make changes to compile it in newer versions.


The current, updated, .pas files have, however, been integrated into the VCL source. The best option is probably to make your own design-time package out of these. To do this you will need to find the sources in :

Vcl.Shell.ShellConsts.pas
Vcl.Shell.ShellCtrls.pas

in :

[ProgramFiles]\Embarcadero\Studio\17.0\source\vcl\

  • Next, copy these to a working directory for your new package.
  • Create a new package (File -> New -> Package)
  • Save the package as ShellControls.bpl in your working directory and add the two source files.
  • Edit your working copy of Vcl.Shell.ShellCtrls.pas to add as the last item in the interface section :

    procedure Register;
    
  • And add as the first item in the implementation section :

    procedure Register;
    begin
      RegisterComponents('Shell Controls', [TShellListView]);
      RegisterComponents('Shell Controls', [TShellTreeView]);
      RegisterComponents('Shell Controls', [TShellChangeNotifier]);
    end;
    
  • Save the package. Right-click, the .bpl in the Project Manager and select -> Install. Accept any required references the IDE notifies you about and you should be done.


回答2:

According to docs copy of the Samples is here: http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/trunk/ This is SVN repository, so you will have to use Version Control IDE plugin or separate app to get sources.