| Shell Controls: Delphi's Hidden Gems | |||||||||||||||||
| How to create a reasonable Delphi facsimile of the Windows explorer, all without writing a single line of code. | |||||||||||||||||
Article submitted by: George Merriman for the Delphi Programming Quickies Contest.
Delphi's shell controls are hidden gems: they are hard to find and lack any meaningful documentation. I discovered them, almost by accident, while working on a recent project. I hope that this short account of what I discovered will prove to be both interesting and useful for you.
Due to the lack of documentation, the only way I could figure out how these components work was to create a quick-and-dirty test harness. It consists of some Panel controls, a Splitter, and one each of the shell controls from the Samples palette, as shown in the screen shot below. There is nothing unusual going on with the form layout, so I want to move on to the interesting bits. You can check out the details in the Delphi 7 project files included in the download. Be sure to check out the Align property of the controls.
![]() You will notice that the Object Inspector shows some properties, listed in red, that allow you to interconnect the shell controls at the click of a button. If you run the app without setting these, the controls work individually, but don't work together as they do in Windows Explorer. If, however, you use Object Inspector to set the ShellTreeView property of the ShellListView to point to your tree view, and the ShellComboBox property of the tree view to your ShellComboBox, you will see these three controls start working together. Click, set, "connect" On ShellChangeNotifier Now we have a reasonable Delphi facsimile of the Windows explorer, all without writing a single line of code. It doesn't do much, but you can right-click and double click the items in the tree and list views and get the expected results. The real value of our little project is that we can use it as the basis for further work, which is exactly what I intend to do in my next article. |
|||||||||||||||||


