6.03.2013 Create a Simple File Browser in 2 Minutes!

File folder icon
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!

Today we try out the speed Lazarus. 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 icon, so you will easily spot them. Just drop them, no need for 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!

Download Sample Code

You can download an example source code zip file from here: http://db.tt/LOmni33C
Size: 550 KB
The package contains compiled executable EXE file.

Image: http://www.iconarchive.com



Copyright 2013 LazPlanet
Carbon 12 Blogger template by Blogger Bits. Supported by Bloggermint