Recent

Author Topic: TDirectoryListBox  (Read 17313 times)

kaisen2100

  • Newbie
  • Posts: 1
TDirectoryListBox
« on: November 18, 2006, 01:51:13 am »
i can't find any TDirectoryListBox or something like that to see a Directory Tree ... I cannot find code to put in a list all the subdirs from a dir ... :(

There any code (or any TDirectoryListBox component)  to see the the subdirs form, for example, "C:\" (by the moment i am working just on win32)?

Thanks in advance

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: TDirectoryListBox
« Reply #1 on: September 15, 2011, 04:01:50 pm »
See TDirectoryEdit on Misc tab.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: TDirectoryListBox
« Reply #2 on: September 15, 2011, 04:07:38 pm »
TShellTreeView on same misc tab lets you show all folders on your form.

Just 1 thing, when i set its ShellListView property to new TShellListView, and then deleted the TShellListView, Lazarus crashed. So it might be best to remove their link first when deleting component.

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #3 on: September 15, 2011, 04:20:29 pm »
See TDirectoryEdit on Misc tab.

thank you... I'll try...

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #4 on: September 15, 2011, 04:26:57 pm »
I am simply using it in order to have an array of strings where each string corresponds to each directory in a determined path (say c:\)
how can I obtain this using the components you advised me to use?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: TDirectoryListBox
« Reply #5 on: September 15, 2011, 04:32:53 pm »
You could use TFileSearcher.

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #6 on: September 15, 2011, 04:37:53 pm »
You could use TFileSearcher.

ehm, which is not in "misc"
I cannot find it  :-[

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #7 on: September 15, 2011, 04:38:48 pm »
You could use TFileSearcher.

ehm, which is not in "misc"
I cannot find it  :-[

btw, for me it is also ok to write some piece of code :)

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: TDirectoryListBox
« Reply #8 on: September 15, 2011, 04:41:16 pm »
TFileSearcher is not a component.

Search on this forum for the usage.
« Last Edit: September 15, 2011, 04:43:15 pm by typo »

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #9 on: September 15, 2011, 05:12:59 pm »
TFileSearcher is not a component.

Search on this forum for the usage.

does not it exist some "findalldirectories" or some way to simply use "findallfiles" and get the directories in a path?

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #10 on: September 15, 2011, 05:16:11 pm »
if I use
ciao = tfilesearch.create;
ciao.search(...)

i find a single file/directory...

in the forum I only found http://www.lazarus.freepascal.org/index.php/topic,13266.msg69291.html#msg69291

but it was used for files (not for folders)...


sorry if I am not so smart, but I am simply not managing in obtaining what I want  :-[

can you link me some piece of documentation?

typo

  • Hero Member
  • *****
  • Posts: 3051
« Last Edit: September 15, 2011, 05:43:54 pm by typo »

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: TDirectoryListBox
« Reply #12 on: September 15, 2011, 05:49:41 pm »
Code: [Select]
directorylistbox1.Items.clear;
if FindFirst ('immagini' + pchar + 'sfondi' +pchar +'*', faDirectory, Rec) = 0 then
try
repeat
if (rec.name <> '.') and (rec.name <> '..') then directoryListBox1.Items.Add(Rec.Name) ;
until FindNext(Rec) <> 0;
finally
FindClose(Rec) ;
end;

this is my solution, where directorylistbox1 is a Tlistbox and Rec is a Tsearchrec

 

TinyPortal © 2005-2018