Post by xxgeek on Aug 28, 2023 15:20:14 GMT
A new FolderDialog developed from the JB FolderDialog in JB functions.
This FolderDialog shows the files in each folder as well as the folders, and could be edited easily to select files as well as folders, but the Windows FileDialog is much better for File selection.
It's good to see the files when choosing a folder.
EDIT - Changed to a 'dialog_modal' window from a 'window'
This FolderDialog shows the files in each folder as well as the folders, and could be edited easily to select files as well as folders, but the Windows FileDialog is much better for File selection.
It's good to see the files when choosing a folder.
EDIT - Changed to a 'dialog_modal' window from a 'window'
'
caption$ = "Please Select a Folder blah blah blah blah blah blah blah blah blah"
call browser$ caption$
print "You selected " : print FolderDialog$
end
'sub to make folder dialog window
sub browser$ caption$
global FolderDialog$
dim info$(0, 0)
dim folderInfo$(0, 0)
' fs = 10
WindowWidth = 700
WindowHeight = 500'670
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
gosub [FolderDlgGetDrives]
statictext #folderdlg.selection, "Selection >> ", 40, 505, 95, 15
statictext #folderdlg.caption, caption$, 150, 20, 525, 35
listbox #folderdlg.filelist, fileList$(, [fileSelect], 350, 50, 320, 310
listbox #folderdlg.list, FolderList$(, [FolderDlgSelect], 15, 50, 320, 310
button #folderdlg.default, "OK", [FolderDlgOk], UL, 220, 410, 75, 25
button #folderdlg.back, "< < <", [FolderDlgBack], UL, 10, 10, 60, 30
button #folderdlg.C, "Cancel", [FolderDlgCancel], UL, 395, 410, 75, 25
button #folderdlg.plusfont, "+", [plusFont], UL, 75, 10, 30, 30
button #folderdlg.minusfont, "-", [minusFont], UL, 110, 10, 30, 30
textbox #folderdlg.text, 15, 360, 655, 25
BackgroundColor$ = "lightgray"
open "Just Basic FolderDialog" for dialog_modal as #folderdlg
#folderdlg, "trapclose [FolderDlgCancel]"
#folderdlg.text, "Selected (Drive \ Folder \ File) Path Appears Here"
#folderdlg, "font Arial 12 bold"
#folderdlg.filelist, "singleclickselect"
#folderdlg.list, "singleclickselect"
fontsize = 12
wait
[minusFont]
fontsize = fontsize - 1
#folderdlg.list, "font arial ";fontsize;" bold"
#folderdlg.filelist, "font arial ";fontsize;" bold"
wait
[plusFont]
fontsize = fontsize + 1
#folderdlg.list, "font arial ";fontsize;" bold"
#folderdlg.filelist, "font arial ";fontsize;" bold"
wait
[FolderDlgSelect]
#folderdlg.list, "selection? temp$"
if temp$ <> "" then
level = level+1
folder$ = folder$; temp$; "\"
#folderdlg.text, folder$
gosub [FolderDlgGetDir]
#folderdlg.list, "reload"
#folderdlg.list, "select 0"
#folderdlg.default "!setfocus"
end if
wait
[FolderDlgBack]
if level > 0 then
level = level-1
if level = 0 then
folder$ = ""
gosub [FolderDlgGetDrives]
else
i = len(folder$)-1
while mid$(folder$, i, 1) <> "\" and mid$(folder$, i, 1) <> ""
i = i-1
wend
folder$ = left$(folder$, i)
gosub [FolderDlgGetDir]
end if
#folderdlg.text, folder$
fileList$(0) = " F I L E S"
#folderdlg.list, "reload"
#folderdlg.filelist, "reload"
end if
wait
[FolderDlgGetDrives]
c = 1
while word$(Drives$, c) <> ""
c = c+1
wend
redim FolderList$(c)
FolderList$(0) = " D R I V E S"
for i = 1 to c
FolderList$(i) = word$(Drives$, i)
next i
redim fileList$(0)
return
[FolderDlgGetDir]
files folder$, info$(
s = val(info$(0,0))
t = val(info$(0,1))
redim FolderList$(t)
FolderList$(0) = " F O L D E R S"
for i = 1 to t
FolderList$(i) = info$(i+s, 1)
next i
[filesBack]
files folder$, "*.*", folderInfo$()
numFiles = val(folderInfo$(0, 0))
redim fileList$(numFiles)
for x = 1 to numFiles
filename$ = folderInfo$(x, 0)
fileList$(x) = filename$
next x
fileList$(0) = " F I L E S"
sort fileList$(), 0 , numFiles
#folderdlg.filelist, "reload"
return
[fileSelect]
#folderdlg.filelist "selection? file$"
#folderdlg.text, folder$;file$
wait
[FolderDlgOk]
#folderdlg.text, "!contents? FolderDialog$"
If right$(FolderDialog$,1) = "\" then
if right$(FolderDialog$,2 ) = ":\" then [goAround]
FolderDialog$ = left$(FolderDialog$, len(FolderDialog$) - 1)
else
notice "The Selection was Not a Folder or Drive" : close #folderdlg : wait ' uncomment to allow selection of "FILES" as well as folders.
[goAround]
end if
[FolderDlgCancel]
close #folderdlg
end sub