|
Post by chrissi75 on Jul 9, 2018 18:08:07 GMT
Hello guys,
I search for a way to put all files and subdirectories of a directory in one listbox. So far, it only works with either the subdiretories or with the files but not with both.
Does somebody have a clue how to do it?
Thanks
Chris
dim infolistA$(1,1)
dim dateienlistA$(1000)
nomainwin
call GetFilesforListA
listbox #main.listA, dateienlistA$(), [selectionMade], 5, 35, 200, 100
WindowWidth = 300
WindowHeight = 400
open "Test Window" for window as #main
print #main, "trapclose [quit]"
wait
[quit]
close #main
end
sub GetFilesforListA
myfolder$ = DefaultDir$
files myfolder$, infolistA$()
totfiles = val(infolistA$(0,0))
redim dateienlistA$(totfiles)
for i = 1 to totfiles
dateienlistA$(i) = infolistA$(i,0)
max = i + 1
next i
end sub
|
|
|
Post by tsh73 on Jul 9, 2018 18:51:33 GMT
dim infolistA$(1,1) dim dateienlistA$(1000) nomainwin
call GetFilesforListA
listbox #main.listA, dateienlistA$(), [selectionMade], 5, 35, 200, 100 WindowWidth = 300 WindowHeight = 400
open "Test Window" for window as #main print #main, "trapclose [quit]"
wait
[quit] close #main end
[selectionMade] #main.listA "selection? selection$" descr$=" (file)" if selection$ = ".." then descr$=" (up link)" if left$(selection$, 1) = "[" then descr$=" (folder)" notice "You've selected ";chr$(34);selection$;chr$(34);descr$ wait
sub GetFilesforListA myfolder$ = DefaultDir$ files myfolder$, infolistA$() totfiles = val(infolistA$(0,0)) totSubDirs = val(infolistA$(0,1)) redim dateienlistA$(totfiles+totSubDirs) j = 0 dateienlistA$(j) =".." 'up link 'directories, make them visible with [] for i = 1 to totSubDirs j=j+1 dateienlistA$(j) = "[";infolistA$(totfiles+i,1);"]" 'max = i + 1 '??? next i 'files for i = 1 to totfiles j=j+1 dateienlistA$(j) = infolistA$(i,0) 'max = i + 1 '??? next i end sub
|
|
|
Post by chrissi75 on Jul 9, 2018 20:32:46 GMT
Hello tsh73,
thanks. That is so good!!
~Chris
|
|