Post by donnybowers on Apr 27, 2022 20:07:03 GMT -5
I was able to create a simple text editor, but AUTORESIZE doesn't work in Linux 64bit. -- RETURNS ERROR "Message not understood"
Remove that line and this little text editor works great. I believe I have all the bugs out of the code.
Remove that line and this little text editor works great. I believe I have all the bugs out of the code.
nomainwin
WindowWidth=int(DisplayWidth/3)
EdWidth=WindowWidth-20
WindowHeight=DisplayHeight-100
EdHeight=WindowHeight-65
UpperLeftX=int(WindowWidth*2)
UpperLeftY=50
fileName$=""
menu #main, "&File", "&New", [new], "&Open", [open],_
"&Save", [save],|, "Quit (&No Save)", [quitNoSave],_
"&Quit", [quit]
texteditor #main.ed, 5, 5, EdWidth, EdHeight
open "EDUARDO" for window as #main
print #main, "font arial 15 bold"
print #main.ed, "!AUTORESIZE"
print #main, "trapclose [quit]"
wait
[new]
print #main.ed, "!contents? test$"
if test$<>"" or fileName$<>"" then gosub [saver]
#main.ed "!cls"
fileName$=""
wait
[open]
'SEE IF FILE NEEDS TO BE SAVED
print #main.ed, "!contents? temp$"
if temp$<>"" or fileName$<>"" then gosub [saver]
'OPEN FILE
filedialog "Open text file", "*.txt", fileName$
if fileName$<>"" then
open fileName$ for input as #1
print #main.ed, "!cls"
txt$=input$(#1, lof(#1))
print #main.ed, txt$;
close #1
end if
wait
[save]
if fileName$<>"" then
gosub [saver]
else
gosub [saveAs]
gosub [saver]
end if
wait
[saveAs]
filedialog "Save As", "*.*", fileName$
if fileName$="" then notice "File Not Saved" : wait
length=len(fileName$)
test$=right$(fileName$,4)
if lower$(test$)<>".txt" then fileName$=fileName$+".txt"
return
[saver]
print #main.ed, "!contents? txt$";
if fileName$="" then gosub [saveAs]
open fileName$ for output as #1
print #1, txt$;
close #1
RETURN
[quit]
gosub [saver]
close #main
end
[quitNoSave]
close #main
end