Post by angelo2449 on Sept 28, 2018 15:01:49 GMT -5
Hi guys,
I wrote this code that stores the result in the clipboard.
I can not get a single-row string, the string > Ridotta$ < is always composed of three lines (two empty).
How can I act to get a clean string?
Thank you.
I wrote this code that stores the result in the clipboard.
I can not get a single-row string, the string > Ridotta$ < is always composed of three lines (two empty).
How can I act to get a clean string?
Thank you.
nomainwin
WindowWidth = 530
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "green"
texteditor #main.edit, -200, -200, 60, 20
groupbox #main.gr1, "Input Dati", 30, 5, 450, 215
groupbox #main.gr2, "Zenith", 35, 30, 430, 120
statictext #main.text1, "Angolo Centesimale (°) >>>>>>", 50, 60, 250, 20
statictext #main.text2, "Angolo Sessagesimale (c) >>>>>>", 50, 90, 250, 20
statictext #main.text3, "Angolo Radianti (r) >>>>>>", 50, 120, 250, 20
radiobutton #main.radcenta, "", [CentaSet], [CentaReset], 330, 55, 25, 25
radiobutton #main.radsessa, "", [SessaSet], [SessaReset], 330, 85, 25, 25
radiobutton #main.radradia, "", [RadiaSet], [RadiaReset], 330, 115, 25, 25
TextboxColor$ = "yellow"
textbox #main.centa, 355, 55, 100, 25
textbox #main.sessa, 355, 85, 100, 25
textbox #main.radia, 355, 115, 100, 25
statictext #main.text4, "Distanza inclinata >>>>>>", 80, 185, 250, 20
textbox #main.dist, 355, 180, 100, 25
TextboxColor$ = "white"
groupbox #main.gr3, "Risultato", 30, 225, 450, 50
statictext #main.text5, "Distanza ridotta >>>>>>", 80, 245, 250, 20
textbox #main.ridotta, 355, 240, 100, 25
button #main.info, "Info", [Main.Info], UL, 30, 290, 100, 35
button #main.pulisci, "Pulisci", [Main.Pulisci], UL, 145, 290, 100, 35
button #main.calc, "Calcola", [Main.Calcola], UL, 260, 290, 100, 35
button #main.esci, "Esci", [quit.main], UL, 380, 290, 100, 35
open "INTERSEZIONE IN AVANTI - CALCOLO DELLA DISTANZA RIDOTTA" for window as #main
#main, "font courier_new 10 16 bold"
#main, "trapclose [quit.main]"
#main.centa, "!disable"
#main.sessa, "!disable"
#main.radia, "!disable"
wait
' ----------------------------
[Main.Pulisci]
#main.centa, ""
#main.sessa, ""
#main.radia, ""
#main.dist, ""
#main.ridotta, ""
#main.radcenta, "reset"
#main.radsessa, "reset"
#main.radradia, "reset"
wait
' ----------------------------
[CentaSet]
#main.centa, "!enable"
#main.sessa, "!disable"
#main.radia, "!disable"
#main.centa, "!setfocus"
Angolo$ = "#main.centa"
Modo$ = "Centesimale"
wait
' ----------------------------
[CentaReset]
wait
' ----------------------------
[SessaSet]
#main.sessa, "!enable"
#main.centa, "!disable"
#main.radia, "!disable"
#main.sessa, "!setfocus"
Angolo$ = "#main.sessa"
Modo$ = "Sessagesimale"
wait
' ----------------------------
[SessaReset]
wait
' ----------------------------
[RadiaSet]
#main.radia, "!enable"
#main.centa, "!disable"
#main.sessa, "!disable"
#main.radia, "!setfocus"
Angolo$ = "#main.radia"
Modo$ = "Radianti"
wait
' ----------------------------
[RadiaReset]
wait
' ----------------------------
[Main.Info]
Notice "Info" + chr$(13) + "Clicca il bottone corrispondente all'Angolo da inserire" + chr$(13) +_
"Inserisci l'Angolo e la Distanza e clicca il pulsante > Calcola <." + chr$(13) +_
"Il risultato viene mostrato nel campo > Distanza ridotta < e" + chr$(13) +_
"memorizzato negli Appunti di Windows"
wait
' ----------------------------
[Main.Calcola]
select case Modo$
case "Centesimale"
#main.centa, "!contents? AngoloCenta"
AngoloRad = AngoloCenta / 200 * 3.14159
print AngoloRad
case "Sessagesimale"
#main.sessa, "!contents? AngoloSessa"
AngoloSessaDec = int(AngoloSessa) + (AngoloSessa - int(AngoloSessa)) / 60 * 100
AngoloRad = AngoloSessaDec / 180 * 3.14159
print AngoloSessa
print AngoloSessaDec
print AngoloRad
case "Radianti"
#main.radia, "!contents? AngoloRad"
end select
#main.dist, "!contents? Distanza"
#Angolo$, "!contents? Zenith"
Ridotta = Distanza * cos(AngoloRad)
#main.ridotta, using("#######.##", Ridotta)
#main.ridotta, "!contents? Ridotta$"
#main.edit, trim$(str$(Ridotta))
#main.edit, "!selectall"
#main.edit, "!copy"
wait
' -------------------------------------------------------
[quit.main] 'End the program
close #main
end
' -------------------------------------------------------
e