Priyatna Codes - My Programming Journey
 


You are here: Home Delphi Stuffs FileMenu
FileMenu Component

Version: 1.00
Release Date: September 28th, 2003

Introduction

FileMenu is a free Delphi Component to extend TMainMenu or TPopUpMenu to dynamically show the content of directories or special shell folders (Desktop, My Documents, My Pictures, Start Menu, Send To, Recent and Favorites). It uses system imagelist. Small foot-print.

Tested under Delphi 6 and Delphi 7, but since it doesn't contain any critical codes, it can be easily ported to any version of Delphi compilers.

 

 

License

This library is released under Mozilla Public License. You can use it in your freeware, shareware or commercial softwares. You can send your modification to me, and if I decide to include it in the main distribution, I will add your name as a contributor. You can read full licensing information here.

 

Installation

There is no special process to install it on Delphi. Just open FileMenuD7.dpk on Delphi IDE and press Install button. I use Delphi 7. If you use another Delphi version, you may have to make some minor changes.

The component will appear in priyatna.org tab.

 

Properties & Methods

There are some main methods of the component:

  • property ParentMenu: TMenuItem;
    is a TMenuItem to stick directories or files menu.

  • property Directory: string;
    is a string that contains valid absolute path of directory to show. Always ensure you fill SpecialFolder property with sfNone when you fill this property.

  • property AutoExecute: Boolean;
    Will launch Windows managed assosiated program when user click on menu item.

  • property SpecialFolder (sfNone, sfDesktop, sfMyDocuments, sfMyPictures, sfStartMenu, sfSendTo, sfRecent, sfFavorites).
    if you want to show Windows's special folder.

  • property AllowedExtensions: string;
    Fill this property if you want to filter the directory content. Filters are semicolon separated, e.g.: *.txt;*.doc

  • property ShowExtensions: Boolean;
    Self explained.

  • property OnClick event
    procedure (Sender: TObject; AMenu: TMenuItem; AFileName: string) of object;
    AMenu will give direct access to TMenuItem (in case you want to change Checked property, for example). AFileName will contain absolute path to file clicked.

  • property OnFilter event
    procedure (Sender: TObject; AFileName: string; var AllowAdd: Boolean) of object;
    Set AllowAdd to False to prevent it from appearing. AllowAdd is set to True by default. AFileName will contain absolute path to file clicked.

 

Download

Download full source code and demo here:

FileMenu.zip
233 KB

Version: 1.00
Release Date: September 28th, 2003