Create a Simple File Browser in 2 Minutes!

File browsers are very useful in our everyday lives. What if you can create a file browser in 2 Minutes? …without writing code? Yes! That’s how we do it in Lazarus.

Lazarus is a Rapid Application Development Environment (RAD in short). It is possible to create complex applications in minutes. Form designer is very handy at designing layouts faster than Cheetah… I’d say!

Today we try out the speed at which Lazarus can help us create things. We will create a File Manager in 2 Minutes, plus, without a single line of code to be written. It will have a drive list (in Windows machines), and the files will be shown in a component at the right upon selection of a folder from the Treeview in left.

(Very) Quick Tutorial

Start Lazarus.
Create a new Application Project (Project -> New Project -> Application -> OK).

Drop a TShellTreeview and TShellListView from the Misc tab. (Drop means click the toolbar buttons and then click on the form.) They both have a yellow folderish kind of icons, so you will be able to easily spot them. Just drop them, no need for fiddling with accurate pixel to pixel positioning!

TShellTreeview and TShellListView components in Lazarus

TShellTreeview and TShellListView on a TForm (Lazarus)

Select ShellTreeView1 and set its Align property to alLeft. The treeview control will jump and sit on the left.

Align treeview component to left

After aligning the TShellTreeview to left in Lazarus

Go to Additional tab and click on the TSplitter button and then click TShellTreeView. This will allow us to resize the treeview area at runtime.

TSplitter component in Lazarus toolbar

Select the TShellListview and set its Align property to alClient and ShellTreeview property to ShellTreeView1.

Final form layout after the alignment of TShellListView

Voila! Its done!

Now Run it (F9 or Run -> Run).

File browser made with Lazarus in 2 Minutes!

Image: http://www.iconarchive.com

Ref:
http://www.youtube.com/watch?v=Vee9x90Qm4E

Downloads

You can download the source code for the tutorial project and executable/EXE files from the links below: