|
Post by angelo2449 on Jul 2, 2018 4:56:11 GMT -5
Hi Guys, maybe I was not clear in the post, so I am attaching the code :
if FileExists("C:\AutocadSupporto\Squadro\DatiSquadro.dat") then open "C:\AutocadSupporto\Squadro\DatiSquadro.dat" for input as #2 line input #2, Nome1$ line input #2, Nome2$ close #2 end if
if FileExists("C:\AutocadSupporto\Contatori\Counter.dat") then open "C:\AutocadSupporto\Contatori\Counter.dat" for input as #3 input #3, Contatore input #3, Passo close #3 end if
nomainwin WindowWidth = 960 WindowHeight = 190
UpperLeftX = 400 UpperLeftY = 100
BackgroundColor$ = "cyan" ForegroundColor$ = "black"
loadbmp "bmp","Squadro.bmp"
TextboxColor$ = "yellow" textbox #main.nome, 175, 5, 320, 25 statictext #main.txt1, "Nome del Punto >>>", 5, 10, 150, 20 textbox #main.dist1, 500, 5, 80, 25 textbox #main.dist2, 585, 5, 80, 25 textbox #main.delta1, 500, 75, 80, 25 textbox #main.delta2, 585, 75, 80, 25
TextboxColor$ = "white" textbox #main.dip, 5, 40, 490, 25 textbox #main.nota, 5, 75, 490, 25 statictext #main.txt2, "Distanza", 502, 35, 80, 20 statictext #main.txt3, "Squadro", 587, 35, 80, 20 statictext #main.txt4, "Delta1", 502, 55, 60, 20 statictext #main.txt5, "Delta2", 586, 55, 60, 20
button #main.b1, "1", [B1], Ul, 500, 110, 30, 30 button #main.b2, "2", [B2], Ul, 540, 110, 30, 30 button #main.b3, "3", [B1], Ul, 580, 110, 30, 30 button #main.b4, "4", [B4], Ul, 620, 110, 30, 30 button #main.b5, "5", [B5], Ul, 660, 110, 30, 30 button #main.b6, "6", [B6], Ul, 700, 110, 30, 30 button #main.b7, "7", [B7], Ul, 740, 110, 30, 30 button #main.b8, "8", [B8], Ul, 780, 110, 30, 30 button #main.b9, "9", [B9], Ul, 820, 110, 30, 30 button #main.b0, "0", [B0], Ul, 860, 110, 30, 30 button #main.pt, ".", [BK], Ul, 900, 110, 30, 30
graphicbox #main.gb, 830, 4, 100, 100 xb = 45 button #main.accetta, "Accetta", [Main.Accetta], UL, xb + 680, 36, 90, 32 button #main.pulisci, "Pulisci", [Main.Pulisci], UL, xb + 680, 71, 90, 32 button #main.info1, "Info",[Main.Info], UL, xb + 625, 5, 50, 25 button #main.info2, "Info Nota",[Nota1.Info], UL, xb + 680, 5, 90, 25 button #main.bk, "<<",[BK], UL, xb + 625, 71, 50, 32
xaan = -122 ya = -306 '-342
bmpbutton #main.chiodo, "icoChiodo.bmp", [NotaCM], UL, xaan + 130, ya + 410 bmpbutton #main.spig, "icoSpig.bmp", [NotaSP], UL, xaan + 180, ya + 410 bmpbutton #main.rec, "icoRec.bmp", [NotaRES], UL, xaan + 230, ya + 410 bmpbutton #main.picc, "icoPicc.bmp", [NotaPICC], UL, xaan + 280, ya + 410 bmpbutton #main.marc, "icoMarcia.bmp", [NotaMA], UL, xaan + 330, ya + 410 bmpbutton #main.rlin, "icoRecLin.bmp", [NotaREL], UL, xaan + 380, ya + 410 bmpbutton #main.segn, "icoSegno.bmp", [NotaST], UL, xaan + 430, ya + 410 bmpbutton #main.tspig, "icoTmbSpig.bmp", [NotaTOS], UL, xaan + 480, ya + 410 bmpbutton #main.tcen, "icoTmbCen.bmp", [NotaTOC], UL, xaan + 530, ya + 410 bmpbutton #main.aiuol, "icoAiuola.bmp", [NotaAIU], UL, xaan + 580, ya + 410
open "ALLINEAMENTO e SQUADRO 3.0" for window as #main #main, "font courier_new 10 16 bold" #main.nome, Contatore + 10 #main.nome, "!setfocus" #main.gb "down ; drawbmp bmp 0 0 ; flush"
Nomi$ = "Dipentente da >> " + Nome1$ + " - " + Nome2$ #main.dip, Nomi$
wait
' ---------------------------------
[Main.Pulisci]
#main.dist1, "" #main.dist2, "" #main.delta1, "" #main.delta2, "" #main.nome, "" #main.nota, "" #main.dip, ""
wait
' ---------------------------------
[Nota1.Pulisci]
#main.nota1, ""
wait
' -----------------------------------------------------------
[B1]
wait
' -------------------
[B2]
wait
' -------------------
[B3]
wait
' -------------------
[B4]
wait
' -------------------
[B5]
wait
' -------------------
[B6]
wait
' -------------------
[B7]
wait
' -------------------
[B8]
wait
' -------------------
[B9]
wait
' -------------------
[B0]
wait
' -------------------
[BK]
wait
' -------------------
[KGen]
wait
' -------------------
[Main.Info]
WindowWidth = 750 WindowHeight = 290 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "cyan" ForegroundColor$ = "black"
statictext #info.txt1, "- Inserimento della distanza dal primo Punto di appoggio mt.", 20, 20, 600, 20 statictext #info.txt2, "- Inserimento della distanza dal secondo Punto di appoggio mt.", 20, 50, 600, 20 statictext #info.txt6, "- Il dislivello può essere imputato ad un solo Punto di appoggio, il sistema", 20, 80, 650, 20 statictext #info.txt7, " impedirà ogni tentativo di inserimento di un doppio valore del dislivello.", 20,110, 650, 20 statictext #info.txt13, "- Il pulsante > Pulisci < svuota i campi di immissione dal loro contenuto", 20, 140, 650, 20 statictext #info.txt14, "- Il pulsante > X < consente di lasciare la finestra senza salvare i dati.", 20, 170, 650, 20 statictext #info.txt15, "- Il pulsante > Accetta < salva i dati inseriti con i criteri suesposti.", 20, 200, 650, 20
open "Informazioni relative all'inserimento dei dati per eseguire l'intersezione in avanti" for window as #info #info, "font courier_new 10 16 bold" #info, "trapclose [quit.info]"
wait
' ---------------------------------
[quit.info]
close #info wait
' ---------------------------------
[Main.Annulla]
goto [quit.main]
wait
' ---------------------------------
[Main.Accetta]
#main.dist1, "!contents? Dist1$" #main.dist2, "!contents? Dist2$" #main.delta1, "!contents? Delta1$" #main.delta2, "!contents? Delta2$" #main.nome, "!contents? Nome$" #main.nota, "!contents? NotaTotale$"
if trim$(Nome$) = "" then Notice "Attenzione" + chr$(13) + "Nome del Nuovo Punto mancante" wait end if
if instr(NotaTotale$, "Dipentente dai Punti selezionati >>>", 1) > 0 then Notice "Attenzione" + chr$(13) + "Contenuto del campo > Nota < non valido" wait end if
if val(trim$(Dist1$)) = 0 or val(trim$(Dist1$)) > 10.00 then Notice "Attenzione" + chr$(13) + "Valore della prima Distanza non valido" wait end if
if val(trim$(Dist2$)) = 0 or val(trim$(Dist2$)) > 10.00 then Notice "Attenzione" + chr$(13) + "Valore della seconda Distanza non valido" wait end if
if trim$(Delta1$) = "" and trim$(Delta2$) = "" then Notice "Attenzione" + chr$(13) + "Valore del Dislivello mancante" wait end if
if trim$(Delta1$) <> "" and trim$(Delta2$) <> "" then Notice "Attenzione" + chr$(13) + "Il Dislivello deve essere riferito ad un solo Punto" wait end if
if trim$(Dist1$) = "" and trim$(Dist2$) = "" then Notice "Attenzione" + chr$(13) + "Valori delle Distanze mancanti" wait end if
if trim$(Dist1$) = "" and ugu$ = "reset" then Notice "Attenzione" + chr$(13) + "Valore della prima distanze mancante" wait end if
if trim$(Dist2$) = "" and ugu$ = "reset" then Notice "Attenzione" + chr$(13) + "Valore della seconda distanze mancante" wait end if
select case
case (trim$(Delta1$) <> "") Dislivello$ = Delta1$ OrgDislivello$ = "Uno"
case (trim$(Delta2$) <> "") Dislivello$ = Delta1$ OrgDislivello$ = "Due"
end select
if trim$(Nome$) = "" then Nome$ = "Nuovo Punto"
if ugu$ = "set" then
select case
case (trim$(Dist1$) = "") Dist1$ = Dist2$ if fisso$ = "set" then Corda$ = Dist1$
case (trim$(Dist2$) = "") Dist2$ = Dist1$ if fisso$ = "set" then Corda$ = Dist2$
end select
end if
if trim$(NotaTotale$) = "" then NotaTotale$ = "-" if trim$(Corda$) = "" then Corda$ = "0.00"
#main.nome, "!contents? Cont$" if val(trim$(Cont$)) = Contatore + Passo then Contatore = Contatore + Passo end if
open "C:\AutocadSupporto\Contatori\Counter.dat" for output as #3 print #3, Contatore print #3, Passo close #3
open "C:\AutocadSupporto\Squadro\DatiSquadroUno.dat" for output as #1 print #1, trim$(Nome$) print #1, trim$(Dist1$) print #1, trim$(Dist2$) print #1, trim$(Dislivello$) print #1, trim$(OrgDislivello$) print #1, trim$(NotaTotale$) close #1
close #main end
' ---------------------------------
[Nota1.Info]
M1$ = "Nel campo > Nota < viene inserita la nota associata ai pulsanti." M2$ = "E' possibile inserire ulteriore testo." M3$ = "Cliccando il pulsante > Accetta < la Nota verrà salvata." M4$ = "Significato dei Pulsanti : "
WindowWidth = 680 WindowHeight = 460 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray" ForegroundColor$ = "black"
statictext #infonota.i1, M1$, 30, 30, 600, 20 statictext #infonota.i2, M2$, 30, 60, 600, 20 statictext #infonota.i3, M3$, 30, 90, 600, 20 statictext #infonota.i4, M4$, 30, 120, 600, 20
bmpbutton #infonota.chiodo, "icoChiodo.bmp", [nil], UL, 30, 150 statictext #infonota.i5, "Chiodo miniato", 90, 160, 200, 20
bmpbutton #infonota.spig, "icoSpig.bmp", [nil], UL, 30, 200 statictext #infonota.i6, "Spigolo fabbricato", 90, 210, 200, 20
bmpbutton #infonota.rec, "icoRec.bmp", [nil], UL, 30, 250 statictext #infonota.i7, "Spigolo recinzione", 90, 260, 200, 20
bmpbutton #infonota.picc, "icoPicc.bmp", [nil], UL, 30, 300 statictext #infonota.i8, "Picchetto", 90, 310, 200, 20
bmpbutton #infonota.marc, "icoMarcia.bmp", [nil], UL, 30, 350 statictext #infonota.i9, "Marciapiede", 90, 360, 200, 20
bmpbutton #infonota.rlin, "icoRecLin.bmp", [nil], UL, 320, 150 statictext #infonota.i10, "Recinzione", 380, 160, 200, 20
bmpbutton #infonota.segn, "icoSegno.bmp", [nil], UL, 320, 200 statictext #infonota.i11, "Segno a terra", 380, 210, 200, 20
bmpbutton #infonota.tspig, "icoTmbSpig.bmp", [nil], UL, 320, 250 statictext #infonota.i12, "Spigolo tombino", 380, 260, 200, 20
bmpbutton #infonota.tcen, "icoTmbCen.bmp", [nil], UL, 320, 300 statictext #infonota.i13, "Centro tombino", 380, 310, 200, 20
bmpbutton #infonota.aiuol, "icoAiuola.bmp", [nil], UL, 320, 350 statictext #infonota.i14, "Aiuola", 380, 360, 80, 20
button #infonota.esci, "Esci", [quit.Info], UL, 520, 350, 100, 35
open "Info" for window as #infonota #infonota, "font courier_new 10 16 bold" #infonota, "trapclose [quit.Info]"
wait
' -----------------------------------------------------------
[nil] wait
' -----------------------------------------------------------
[NotaCM]
NotaGenerale$ = "Chiodo miniato" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaST]
NotaGenerale$ = "Segno a terra" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaMA]
NotaGenerale$ = "Marciapiede" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaRES]
NotaGenerale$ = "Spigolo recinzione" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaSP] '
NotaGenerale$ = "Spigolo fabbricato" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaTOS]
NotaGenerale$ = "Spigolo Tombino" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaTOC]
NotaGenerale$ = "Centro Tombino" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaPICC]
NotaGenerale$ = "Centro Picchetto" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaREL]
NotaGenerale$ = "Recinzione" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaAIU]
NotaGenerale$ = "Aiuola" goto [NotaGen1]
wait
' -----------------------------------------------------------
[NotaGen1]
#main.nota, NotaGenerale$ #main.dist1, "!setfocus"
wait
' -----------------------------------------------------------
[quit.Info]
close #infonota
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]
close #main
end
' ----------------------------------
[code]
I wish I could write in the fields with the virtual keyboard (now not complete) :
[code] textbox #main.dist1, 500, 5, 80, 25 textbox #main.dist2, 585, 5, 80, 25 textbox #main.delta1, 500, 75, 80, 25 textbox #main.delta2, 585, 75, 80, 25
where I place the cursor, Thank You.
|
|
|
Post by tsh73 on Jul 2, 2018 8:41:19 GMT -5
Try to play with this (API part from NewsLetter98, from here) ' virtual keyboard and a hetfocus attempt ' based in HocusFocus.bas in NL 98 global hndl$
nomainwin
WindowWidth = 552 WindowHeight = 330
UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
statictext #main.statictext1, "textBox1", 30, 16, 144, 20 statictext #main.statictext3, "textBox3", 22, 76, 144, 20 statictext #main.statictext4, "textBox2", 294, 16, 144, 20 statictext #main.statictext5, "textBox4", 294, 76, 144, 20 textbox #main.textbox1, 22, 36, 248, 25 textbox #main.textbox2, 286, 36, 248, 25 textbox #main.textbox3, 22, 96, 248, 25 textbox #main.textbox4, 286, 96, 248, 25 groupbox #main.groupbox10, " VirtualKeyboad ", 22, 131, 504, 165 button #main.1, "1", btn, UL, 38, 151, 25, 25 button #main.2, "2", btn, UL, 62, 151, 25, 25 button #main.3, "3", btn, UL, 86, 151, 25, 25 button #main.Q, "Q", btn, UL, 54, 176, 25, 25 button #main.W, "W", btn, UL, 78, 176, 25, 25 button #main.E, "E", btn, UL, 102, 176, 25, 25 button #main.A, "A", btn, UL, 70, 201, 25, 25 button #main.Z, "Z", btn, UL, 78, 226, 25, 25 button #main.Space, "", btn, UL, 134, 251, 280, 25 button #main.0, "0", btn, UL, 430, 151, 25, 25 button #main.backSpace, "<=", btn, UL, 454, 151, 48, 25
open "Virtual Keyboard and getFocus" for window as #main print #main, "trapclose [quit.main]" 'print #main, "font ms_sans_serif 10"
hndl$= "#main.textbox1" tb1 = hWnd(#main.textbox1) tb2 = hWnd(#main.textbox2) tb3 = hWnd(#main.textbox3) tb4 = hWnd(#main.textbox4) 'print tb1, tb2, tb3, tb4 'set the timer to 50 milliseconds timer 50, [events]
'Wait for events Wait
[quit.main] Close #main END
[events] 'Find out who has the focus currently CallDLL #user32, "GetFocus", handle As long 'print handle select case handle case tb1 hndl$= "#main.textbox1" case tb2 hndl$= "#main.textbox2" case tb3 hndl$= "#main.textbox3" case tb4 hndl$= "#main.textbox4" end select wait
sub btn handle$ key$=word$(handle$, 2, ".") #hndl$ "!contents? txt$" select case key$ case "Space" #hndl$ txt$;" " case "backSpace" #hndl$ left$(txt$, len(txt$)-1) case else #hndl$ txt$;key$ end select end sub
|
|