I have made my first Yab app based on Tedit it also count the lines
window open 50, 50 to 710,530, "View", "TextEditor"
layout "all","View"
window set "View", "minimumto",200,100
menu "File","Open","O","View"
menu "File","Save As...","S","View"
menu "File","Quit","Q","View"
menu"Help","About","A","View"
textedit 0,25 to 660,463, TextEd$, 3, "View"
//Text 10,468 to 100,481, "Text", "Line: ", "View"
inloop = true
while(inloop)
h = window get "View", "height"
Option$="countlines"
LineCount=TEXTEDIT GET TextE$,Option$
Option$ = "currentline"
LineNumber = TEXTEDIT GET TextEd$, Option$
Update()
msg$=message$
switch msg$
case "View:_QuitRequested|"
inloop = false
break
case "View:File:Quit|"
inloop = false
break
case "View:File:Open|"
filename$ = ""
filename$ = filepanel "load-file", "Open File", "",""
if(filename$="")then
TEXTEDIT CLEAR TextEd$
else
//Clear the text Edit box
TEXTEDIT CLEAR TextEd$
//Open the file
open filename$ for reading as #1
while(!eof(1))
//Read a line and stock it in newline
line input #1 newline$
//Add the new line + \n in Text box
textedit add TextEd$, newline$ + "\n"
wend
//close file
close #1
//Place the cursor to line 1 when finished loading the file
textedit set TextEd$, "gotoline", 1
endif
break
case "View:File:Save As...|"
file2save$=""
filename$=""
file2save$ = textedit get$ TextEd$
if file2save$ <> "" then
filename$ = filepanel "save-file", "Save File As ...", "/boot/home",""
if filename$= "" return
open filename$ for writing as #1
print #1 file2save$
close #1
endif
break
case "View:Help:About|"
alert "Developed by Kitsune.", "Ok", "About"
break
end switch
wend
window close "View"
Exit
sub Update()
draw flush "View"
draw text 10,h-2,"Line: "+str$(LineNumber)+"/"+str$(LineCount), "View"
return
end sub
I have a question. Is it possible to run a Terminal from a Yab application? The launch function don’t do it.