Post by metro on Apr 1, 2022 3:38:48 GMT -5
NOT dimension(ing) an array no error thrown just limits output to 10
Also note the Edit menu no longer has "select all".
' dim file$(200) 'NO ERROR IF NOT DIMENSIONED
' ONLY LOADS 10 FILES
if left$(Platform$,3) = "win" then
files #dir, "c:\windows\*.bas" ' or what ever path you want
else 'assume Mac OS or Linux
files #dir, "*.bas"
end if
rec=1
while #dir hasAnswer()
#dir nextFile$()
file$(rec) = #dir name$()
rec=rec+1
wend
nomainwin
WindowWidth = 950
WindowHeight = 620
UpperLeftX = 10
UpperLeftY = 10
listbox #main.open, file$(), [open], 10, 46, 224, 300
statictext #main.st1, "Choose File", 26, 16, 88, 20
textbox #main.fname, 330, 15, 208, 25
statictext #main.st2, "File Name", 254, 16, 74, 20
texteditor #main.edit, 254, 46, 680, 400
button #main.default, "Open", [open], UL, 10, 350, 60, 30
button #main.btncopy, "Copy", [copyit], UL, 80, 350, 60, 30
open "My First LB5 GUI" for dialog as #main
print #main, "font ms_sans_serif 10"
print #main,"trapclose [quit]"
[main.inputLoop] 'wait here for input event
wait
[open]
print #main.open, "selection? fileName$"
if fileName$<>"" then
print #main.fname, fileName$
open fileName$ for input as #1
txt$=""
while eof(#1)=0
line input #1, r$
r$=r$+chr$(13)'+chr$(10)
txt$=txt$+r$
wend
close #1
print #main.edit, "!cls"
print #main.edit, txt$
end if
wait
[copyit]
print #main.edit,"!selectall"
print #main.edit,"!copy"
wait
[quit]
close #main