Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to create a menu from a directory tree (Simple) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Aug-03
Category
VCL-Menu
Language
Delphi 4.x
Views
157
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Christian Cristofori

I wanted to simulate the "favorites" of IE

Answer:

First of all, add this: 
1   
2   procedure CreateTreeMenus(Path: string; Root: TMenuItem);
3   var
4     SR: TSearchRec;
5     Result: Integer;
6     Item: TMenuItem;
7   begin
8     Path := IncludeTrailingBackSlash(Path);
9     Result := FindFirst(Path + '*.*', faDirectory, SR);
10    while (Result = 0) do
11    begin
12      if (((SR.Attr and faDirectory) <> 0) and (SR.Name <> '.') and (SR.Name <> '..'))
13        then
14      begin
15        Item := TMenuItem.Create(Self);
16        Item.Caption := SR.Name;
17        Root.Add(Item);
18        CreateTreeMenus(Path + SR.Name, Item);
19      end;
20      Result := FindNext(SR);
21    end;
22    SysUtils.FindClose(SR);
23  end;
24  
25  //Then call the function in this way: 
26  
27  CreateTreeMenus('C:\MyApp\MyFavs', mnuPreferiti);


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC