Post by angelo2449 on Oct 2, 2020 23:50:02 GMT -5
Hi Guys,
in this program, which appears correct, LB makes a error, at least it seems.
Resetting a radio button causes an infinite loop!
in this program, which appears correct, LB makes a error, at least it seems.
Resetting a radio button causes an infinite loop!
nomainwin
if FileExists("C:\AutocadSupporto\Config\Unita.dat") then
open "C:\AutocadSupporto\Config\Unita.dat" for input as #14
input #14, Disco$
close #14
end if
WindowWidth = 750
WindowHeight = 430
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "yellow"
ForegroundColor$ = "black"
xa = 30 : ya = 40
texteditor #main.edit, -400, -400, 200, 100
textbox #main.fin, xa + 15, 20, 640, 25
groupbox #main.colore, "Colore", xa + 20, ya + 15, 300, 115
radiobutton #main.nero, "Linea colore Nero", [NeroSet], [NeroReset], xa + 25, ya + 40, 200, 25
radiobutton #main.rosso, "Linea colore Rosso", [RossoSet], [RossoReset], xa + 25, ya + 70, 200, 25
groupbox #main.linea, "Linea", xa + 335, ya + 15, 317, 115
radiobutton #main.continua, "Linea Continua", [ContinuaSet], [ContinuaReset], xa + 345, ya + 40, 200, 25
radiobutton #main.tratt, "Linea Tratteggiata", [TrattSet], [TrattReset], xa + 345, ya + 70, 200, 25
radiobutton #main.punt, "Linea Puntinata", [PuntSet], [PuntReset], xa + 345, ya + 100, 200, 25
button #main.si, "Salva i 10 Punti", [Salva10Punti], UL, xa + 225, ya + 150, 210, 45
button #main.info, "Info", [Info], UL, 45, ya + 210, 120, 40
button #main.libr, "Libretto", [Libretto], UL, 255, ya + 210, 210, 40
button #main.esci, "Esci", [quit.main], UL, 565, ya + 210, 120, 40
TextboxColor$ = "cyan"
textbox #main.notifica, 42, ya + 275, 643, 25
open "Gestione della Linea di Tipo > 7 < - Contorni 10 Punti - Ver. 30/09/2020" for window as #main
#main, "font courier_new 10 17 bold"
#main, "trapclose [quit.main]"
CodColor$ = "nil"
CodLinea$ = "nil"
#main.edit, "!cls";
#main.edit, "!paste";
#main.edit, "!contents? StringaIn$";
StringaIn$ = "7|0|1430|1430|1430|1430|1430|1430|1430|1430|1430|1430|NC|" ''7|0|1310|1290|1280|1100|1400|1420|1430|1390|1310|1290|N|T|
#main.fin, trim$(StringaIn$)
if left$(StringaIn$, 4) = "7|0|" then
Pos1 = len(StringaIn$) - 4 ' |RC|
CodColor$ = mid$(StringaIn$, Pos1 + 2, 1)
CodLinea$ = mid$(StringaIn$, Pos1 + 3, 1)
end if
print "left$(StringaIn$, 4) xxxx "; left$(StringaIn$, 4)
print "Pos1 xxxx "; Pos1
print "StringaIn$ xxxx "; StringaIn$
print "CodColor$ xxxx "; CodColor$
print "CodLinea$ xxxx "; CodLinea$
if CodColor$ <> "nil" then
select case CodColor$
case "N"
#main.nero, "set"
case "R"
#main.rosso, "set"
end select
end if
if CodLinea$ <> "nil" then
select case CodLinea$
case "C"
#main.continua, "set"
case "T"
#main.tratt, "set"
case "P"
#main.punt, "set"
end select
end if
CodColor$ = ""
FlagColor = 0
#main.nero, "reset"
#main.rosso, "reset"
#main.continua, "reset"
#main.tratt, "reset"
#main.punt, "reset"
wait
' -----------------------------------------------
[Libretto]
run "Notepad " + Disco$ + "\AutocadSupporto\Libretto\LibrettoPregeo.dat"
wait
' -----------------------------------------------
[Salva10Punti]
if CodColor$ = "nil" then
Notice "Attenzione" + chr$(13) + "Devi impostare il Colore della linea"
wait
end if
if CodLinea$ = "nil" then
Notice "Attenzione" + chr$(13) + "Devi impostare il Tipo della linea"
wait
end if
#main.fin, "!contents? Contenuto$"
Contenuto$ = trim$(Contenuto$) + CodColor$ + CodLinea$ + "|"
open Disco$ + "\AutocadSupporto\Libretto\LibrettoPregeo.dat" for append as #15
print #15, Contenuto$
close #15
#main.edit, "!cls";
#main.edit, CodColor$ + "#" + CodLinea$;
#main.edit, "!selectall";
#main.edit, "!copy";
#main.notifica, "Riga salvata in > LibrettoPregeo <"
Timer 1000, [Salta]
wait
[Salta]
#main.notifica, ""
#main.libr, "!setfocus"
close #main
end
' ----------------------------
[NeroSet]
CodColor$ = "N"
FlagColor = 1
wait
' ----------------------------
[NeroReset]
[RossoReset]
[ContinuaReset]
[TrattReset]
[PuntReset]
wait
' ----------------------------
[RossoSet]
CodColor$ = "R"
FlagColor = 1
wait
' ----------------------------
[Controlla]
if FlagColor = 0 then
Notice "Attenzione" + chr$(13) + "Devi prima scegliere il Colore!"
#Caso$, "reset"
wait
else
return
end if
' ----------------------------
[ContinuaSet]
Caso$ = "#main.continua"
gosub [Controlla]
CodLinea$ = "C"
wait
' ----------------------------
[TrattSet]
Caso$ = "#main.tratt"
gosub [Controlla]
CodLinea$ = "T"
wait
' ----------------------------
[PuntSet]
Caso$ = "#main.punt"
gosub [Controlla]
CodLinea$ = "P"
wait
' ----------------------------
[Info]
if FileExists("C:\AutocadSupporto\Info\SiNo7.txt") then
run "Notepad " + "C:\AutocadSupporto\Info\SiNo7.txt"
end if
wait
' ----------------------------
function FileExists(FilePath$)
dim FileExistsInfo$(1,1) ' ritorna 0 (zero) se il file non esiste, 1 (uno) se esiste
files "", FilePath$, FileExistsInfo$(
FileExists = val(FileExistsInfo$(0,0))
end function
' -------------------------------
[quit.main]
#main.edit, "!cls";
#main.edit, "Fine";
#main.edit, "!selectall";
#main.edit, "!copy";
close #main
end
' -----------------------------------------------
The error occurs in :
[ContinuaSet]
[TrattSet]
[PuntSet]
What do you think? Can it be avoided?
Thank you.