|
Post by xxgeek on Oct 23, 2022 16:17:16 GMT
To set focus on a textbox or button is the easy part. #textbox "!setfocus" #button "!setfocus"
I took the liberty of adjusting some code to make navigation less cumbersome on that bets/tot page.
From the main menu, when you click to goto that page just hit [enter] and you're setup to tab in a cycle through the textboxes, the top buttons will cycle after #8 textbox in each new race. see if that helps any. Not exactly what you want (no clearing of textbox or saving data yet)
Below this code I've added another bit of code. It's a program that will search the JB help files and tutorial for keywords. I use it all the time and it has helped me immensly as I try to learn the in's and out's of JB coding.
'RACENITE GUI nomainwin WindowWidth = DisplayWidth WindowHeight = DisplayHeight UpperLeftX=INT((DisplayWidth-WindowWidth)/2) UpperLeftY=INT((DisplayHeight-WindowHeight)/2) W = DisplayWidth H = DisplayHeight DIM winr(9), bets(9,8), nwbet(8), pay(9) DIM racnm$(9),racsp$(9),hornm$(9,8),horsp$(9,8),info$(10,10),horod$(9,8) GLOBAL filenm$, pay1, payb, unit, roun$, less1, num$, odst$, rc, tot, w, a$, entr num$ = "100012001250137515001625175018752000212522502500275030003333350040004500500055006000650070007500800085009000" odst$ = "EVENS 6:5 5:4 11:8 6:4 13:8 7:4 15:8 2:1 85:40 9:4 5:2 11:4 3:1100:30 7:2 4:1 9:2 5:1 11:2 6:1 13:2 7:1 15:2 8:1 17:2 9:1"
[main] ' set default parameters pay1=70 payb=60 unit=50 roun$="F" less1=1 filenm$ = "RACENITE.DAT" gosub [init]
[start] 'show main window BackgroundColor$ = "cyan" statictext #main.st1, "RACENITE PROGRAM", W/3, 2, W/1.8, H/12 button #main.btn1, "Adjust Parameters", [adjust], UL, W/5, H/12, W/1.8, H/15 button #main.btn2, "Enter Race Names and Sponsors", [rcentry], UL, W/5, 2*H/12, W/1.8, H/15 button #main.btn2, "Enter Horse Names and Owners", [entry], UL, W/5, 3*H/12, W/1.8, H/15 button #main.btn3, "Enter Bets and Show Tote", [runtot], UL, W/5, 4*H/12, W/1.8, H/15 button #main.btn4, "Save Data", [savdat], UL, W/5, 5*H/12, W/1.8, H/15 button #main.btn5, "Load Data", [loddat], UL, W/5, 6*H/12, W/1.8, H/15 button #main.btn6, "Display Results", [dispres], UL, W/5, 7*H/12, W/1.8, H/15 button #main.btn7, "Print Results", [prntres], UL, W/5, 8*H/12, W/1.8, H/15 button #main.btn8, "Exit Program", [quit], UL, W/5, 9*H/12, W/1.8, H/15 open "RACENITE" for window as #main f$ = "font Arial_Black 0 "; int(H/18) print #main, f$ print #main, "trapclose [quit]" wait
[quit] 'ask if the user wants to quit confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait 'abort quitting 'now close the window close #main end
[init] ' initialise arrays for i = 1 to 9 racnm$(i) = " " racsp$(i) = " " winr(i) = 0 pay(i) = 0 for j = 1 to 8 bets(i,j) = 0 hornm$(i,j) = " " horsp$(i,j) = " " horod$(i,j) = " " next j next i return
[adjust] ' parameters entry window close #main statictext #adjust.st0, "PARAMETER ADJUSTMENT", W/3, 2, W/2, H/10 statictext #adjust.st1, "Payback % for Race 1 (100 max)", W/8, H/10, W/2, H/15 statictext #adjust.st2, "Payback % other Races (100 max)", W/8, 2*H/10, W/2, H/15 statictext #adjust.st3, "Betting unit - in pence (999 max)", W/8, 3*H/10, W/2, H/15 statictext #adjust.st4, "Round to nearest Five/Ten pence (F/T)", W/8, 4*H/10, W/2, H/15 statictext #adjust.st5, "Starting No. on tickets (1-201)", W/8, 5*H/10, W/2, H/15 statictext #adjust.st6, "Data File Name (????????.DAT)", W/8, 6*H/10, W/2, H/15 button #adjust.btn1, "Update", [adjreset], UL, W/8 + W/2 + 5, 7*H/10, W/5, H/15 button #adjust.btn2, "Return to Main Menu", [adjexit], UL, W/8, 7*H/10, W/3, H/15
textbox #adjust.tb1, W/8 + W/2 + 5, H/10, W/10, H/15 textbox #adjust.tb2, W/8 + W/2 + 5, 2 * H/10.2, W/10, H/15 textbox #adjust.tb3, W/8 + W/2 + 5, 3*H/10.2, W/10, H/15 textbox #adjust.tb4, W/8 + W/2 + 5, 4*H/10.2, W/20, H/15 textbox #adjust.tb5, W/8 + W/2 + 5, 5*H/10.2, W/10, H/15 textbox #adjust.tb6, W/8 + W/2 + 5, 6*H/10.2, W/4, H/15
open "RACENITE - Parameters" for window as #adjust f$ = "font Arial_Black 0 "; int(H/18) print #adjust, f$ print #adjust, "trapclose [adjquit]"
print #adjust.btn2, "!disable"
[adjloop] ' display parameters print #adjust.tb1,pay1 print #adjust.tb2,payb print #adjust.tb3,unit print #adjust.tb4,roun$ print #adjust.tb5,less1 print #adjust.tb6,filenm$ [adjloop2] wait ' await Update button press
[adjreset] ' Update button pressed rstok = 0 print #adjust.btn2, "!disable" print #adjust.tb1, "!contents? ret$"; num = val(ret$) if num > 1 and num < 101 then pay1 = num else rstok = 1 end if print #adjust.tb2, "!contents? ret$"; num = val(ret$) if num > 1 and num < 101 then payb = num else rstok = 1 end if print #adjust.tb3, "!contents? ret$"; num = val(ret$) if num > 1 and num < 1000 then unit = num else rsok = 1 end if print #adjust.tb4, "!contents? ret$"; if ret$ = "F" or ret$ = "T" then roun$ = ret$ else rstok = 1 end if print #adjust.tb5, "!contents? ret$"; num = val(ret$) if num > 0 and num < 202 then less1 = num else rstok = 1 end if print #adjust.tb6, "!contents? ret$"; if ret$ <> "" then filenm$ = ret$ end if if rstok = 0 then print #adjust.btn2, "!enable" goto [adjloop] end if goto [adjloop2]
[adjquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #adjust end
[adjexit] close #adjust goto [start]
[rcentry] close #main rc = 0 statictext #rcentry.st0, "RACE NAMES and SPONSORS EDITING", W/3, 1, W/2, H/20 statictext #rcentry.st1, "Race", W/40, H/20, W/10, H/20 statictext #rcentry.st2, "Race Name Sponsor", W/6, H/7, W/1.5, H/20 button #rcentry.btn1, "1", one, UL, W/5 + 1 * W/12, H/20, W/20, H/15 button #rcentry.btn2, "2", two, UL, W/5 + 2 * W/12, H/20, W/20, H/15 button #rcentry.btn3, "3", three, UL, W/5 + 3 * W/12, H/20, W/20, H/15 button #rcentry.btn4, "4", four, UL, W/5 + 4 * W/12, H/20, W/20, H/15 button #rcentry.btn5, "5", five, UL, W/5 + 5 * W/12, H/20, W/20, H/15 button #rcentry.btn6, "6", six, UL, W/5 + 6 * W/12, H/20, W/20, H/15 button #rcentry.btn7, "7", seven, UL, W/5 + 7 * W/12, H/20, W/20, H/15 button #rcentry.btn8, "8", eight, UL, W/5 + 8 * W/12, H/20, W/20, H/15 button #rcentry.btn9, "Update", [rcentupd], UL, W/2, 8*H/10, W/5, H/18 button #rcentry.btn10, "Return to Main Menu", [rcentexit], UL, W/8, 8*H/10, W/3, H/18 statictext #rcentry.tb0, " ", W/8, H/20, W/15, H/16 textbox #rcentry.tb1, W/8, 3 * H/14, W/2.6, H/16 textbox #rcentry.tb11, W/1.9, 3 * H/14, W/2.6, H/16
open "RACENITE - Race Names" for window as #rcentry f$ = "font Arial_Black 0 "; int(H/20) print #rcentry, f$ print #rcentry, "trapclose [rcequit]" print #rcentry.tb1, "!disable" print #rcentry.tb11, "!disable"
[rcentloop] input answer$ if answer$ = "one" then rc = 1 if answer$ = "two" then rc = 2 if answer$ = "three" then rc = 3 if answer$ = "four" then rc = 4 if answer$ = "five" then rc = 5 if answer$ = "six" then rc = 6 if answer$ = "seven" then rc = 7 if answer$ = "eight" then rc = 8 print #rcentry.tb1, racnm$(rc) print #rcentry.tb11, racsp$(rc) if rc <> 0 then rc$ = str$(rc) print #rcentry.tb0, rc$ print #rcentry.btn10, "!disable" print #rcentry.tb1, "!enable" print #rcentry.tb11, "!enable" end if goto [rcentloop] wait
[rcentupd] if rc = 0 then notice "No Race Selected" goto [rcentloop] end if
print #rcentry.tb1, "!contents? racnm$"; print #rcentry.tb11, "!contents? racsp$"; racnm$(rc) = left$(racnm$, 20) racsp$(rc) = left$(racsp$, 20) print #rcentry.tb1, racnm$(rc) print #rcentry.tb11, racsp$(rc) print #rcentry.btn10, "!enable" goto [rcentloop]
[rcequit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #rcentry end
[rcentexit] close #rcentry goto [start]
[entry] close #main rc = 0 statictext #entry.st0, "HORSE NAMES and Owners EDITING", W/3, 1, W/2, H/20 statictext #entry.st1, "Race", W/40, H/20, W/10, H/20 statictext #entry.st2, "Horse Name", W/20, H/8, W/4, H/20 statictext #entry.st2, "Owner", W/1.8, H/8, W/10, H/20 statictext #entry.st3, "1", W/14, 3 * H/14, W/20, H/21 statictext #entry.st4, "2", W/14, 4 * H/14, W/20, H/21 statictext #entry.st5, "3", W/14, 5 * H/14, W/20, H/21 statictext #entry.st6, "4", W/14, 6 * H/14, W/20, H/21 statictext #entry.st7, "5", W/14, 7 * H/14, W/20, H/21 statictext #entry.st8, "6", W/14, 8 * H/14, W/20, H/21 statictext #entry.st9, "7", W/14, 9 * H/14, W/20, H/21 statictext #entry.st10, "8", W/14, 10 * H/14, W/20, H/20 button #entry.btn1, "1", one, UL, W/5 + 1 * W/12, H/20, W/20, H/15 button #entry.btn2, "2", two, UL, W/5 + 2 * W/12, H/20, W/20, H/15 button #entry.btn3, "3", three, UL, W/5 + 3 * W/12, H/20, W/20, H/15 button #entry.btn4, "4", four, UL, W/5 + 4 * W/12, H/20, W/20, H/15 button #entry.btn5, "5", five, UL, W/5 + 5 * W/12, H/20, W/20, H/15 button #entry.btn6, "6", six, UL, W/5 + 6 * W/12, H/20, W/20, H/15 button #entry.btn7, "7", seven, UL, W/5 + 7 * W/12, H/20, W/20, H/15 button #entry.btn8, "8", eight, UL, W/5 + 8 * W/12, H/20, W/20, H/15 button #entry.btn9, "Update", [entupd], UL, W/2, 8*H/10, W/5, H/18 button #entry.btn10, "Return to Main Menu", [entexit], UL, W/8, 8*H/10, W/3, H/18 statictext #entry.tb0, " ", W/8, H/20, W/15, H/16 textbox #entry.tb1, W/8, 3 * H/14, W/2.6, H/16 textbox #entry.tb2, W/8, 4 * H/14, W/2.6, H/16 textbox #entry.tb3, W/8, 5 * H/14, W/2.6, H/16 textbox #entry.tb4, W/8, 6 * H/14, W/2.6, H/16 textbox #entry.tb5, W/8, 7 * H/14, W/2.6, H/16 textbox #entry.tb6, W/8, 8 * H/14, W/2.6, H/16 textbox #entry.tb7, W/8, 9 * H/14, W/2.6, H/16 textbox #entry.tb8, W/8, 10 * H/14, W/2.6, H/16 textbox #entry.tb11, W/1.9, 3 * H/14, W/2.6, H/16 textbox #entry.tb12, W/1.9, 4 * H/14, W/2.6, H/16 textbox #entry.tb13, W/1.9, 5 * H/14, W/2.6, H/16 textbox #entry.tb14, W/1.9, 6 * H/14, W/2.6, H/16 textbox #entry.tb15, W/1.9, 7 * H/14, W/2.6, H/16 textbox #entry.tb16, W/1.9, 8 * H/14, W/2.6, H/16 textbox #entry.tb17, W/1.9, 9 * H/14, W/2.6, H/16 textbox #entry.tb18, W/1.9, 10 * H/14, W/2.6, H/16 open "RACENITE - Horse Names" for window as #entry f$ = "font Arial_Black 0 "; int(H/20) print #entry, f$ print #entry, "trapclose [entquit]" print #entry.tb1, "!disable" print #entry.tb2, "!disable" print #entry.tb3, "!disable" print #entry.tb4, "!disable" print #entry.tb5, "!disable" print #entry.tb6, "!disable" print #entry.tb7, "!disable" print #entry.tb8, "!disable" print #entry.tb11, "!disable" print #entry.tb12, "!disable" print #entry.tb13, "!disable" print #entry.tb14, "!disable" print #entry.tb15, "!disable" print #entry.tb16, "!disable" print #entry.tb17, "!disable" print #entry.tb18, "!disable"
[entloop] input answer$ if answer$ = "one" then rc = 1 if answer$ = "two" then rc = 2 if answer$ = "three" then rc = 3 if answer$ = "four" then rc = 4 if answer$ = "five" then rc = 5 if answer$ = "six" then rc = 6 if answer$ = "seven" then rc = 7 if answer$ = "eight" then rc = 8
gosub [entdisp]
if rc <> 0 then rc$ = str$(rc) print #entry.tb0, rc$ print #entry.btn10, "!disable" print #entry.tb1, "!enable" print #entry.tb2, "!enable" print #entry.tb3, "!enable" print #entry.tb4, "!enable" print #entry.tb5, "!enable" print #entry.tb6, "!enable" print #entry.tb7, "!enable" print #entry.tb8, "!enable" print #entry.tb11, "!enable" print #entry.tb12, "!enable" print #entry.tb13, "!enable" print #entry.tb14, "!enable" print #entry.tb15, "!enable" print #entry.tb16, "!enable" print #entry.tb17, "!enable" print #entry.tb18, "!enable" end if goto [entloop]
[entupd] if rc = 0 then notice "No Race Selected" goto [entloop] end if
print #entry.tb1, "!contents? hornm$"; print #entry.tb11, "!contents? horsp$"; hornm$(rc,1) = left$(hornm$, 20) horsp$(rc,1) = left$(horsp$, 20) print #entry.tb2, "!contents? hornm$"; print #entry.tb12, "!contents? horsp$"; hornm$(rc,2) = left$(hornm$, 20) horsp$(rc,2) = left$(horsp$, 20) print #entry.tb3, "!contents? hornm$"; print #entry.tb13, "!contents? horsp$"; hornm$(rc,3) = left$(hornm$, 20) horsp$(rc,3) = left$(horsp$, 20) print #entry.tb4, "!contents? hornm$"; print #entry.tb14, "!contents? horsp$"; hornm$(rc,4) = left$(hornm$, 20) horsp$(rc,4) = left$(horsp$, 20) print #entry.tb5, "!contents? hornm$"; print #entry.tb15, "!contents? horsp$"; hornm$(rc,5) = left$(hornm$, 20) horsp$(rc,5) = left$(horsp$, 20) print #entry.tb6, "!contents? hornm$"; print #entry.tb16, "!contents? horsp$"; hornm$(rc,6) = left$(hornm$, 20) horsp$(rc,6) = left$(horsp$, 20) print #entry.tb7, "!contents? hornm$"; print #entry.tb17, "!contents? horsp$"; hornm$(rc,7) = left$(hornm$, 20) horsp$(rc,7) = left$(horsp$, 20) print #entry.tb8, "!contents? hornm$"; print #entry.tb18, "!contents? horsp$"; hornm$(rc,8) = left$(hornm$, 20) horsp$(rc,8) = left$(horsp$, 20) gosub [entdisp] print #entry.btn10, "!enable" goto [entloop] wait
[entdisp] print #entry.tb1, hornm$(rc,1) print #entry.tb2, hornm$(rc,2) print #entry.tb3, hornm$(rc,3) print #entry.tb4, hornm$(rc,4) print #entry.tb5, hornm$(rc,5) print #entry.tb6, hornm$(rc,6) print #entry.tb7, hornm$(rc,7) print #entry.tb8, hornm$(rc,8) print #entry.tb11, horsp$(rc,1) print #entry.tb12, horsp$(rc,2) print #entry.tb13, horsp$(rc,3) print #entry.tb14, horsp$(rc,4) print #entry.tb15, horsp$(rc,5) print #entry.tb16, horsp$(rc,6) print #entry.tb17, horsp$(rc,7) print #entry.tb18, horsp$(rc,8) return
[entquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #entry end
[entexit] close #entry goto [start]
[runtot] close #main rc = 0 statictext #runtot.st1, "Race", W/40, H/20, W/10, H/20 statictext #runtot.st2, "Horse", W/40, H/7, W/12, H/18 statictext #runtot.st3, "1", W/14, 3 * H/14, W/20, H/21 statictext #runtot.st4, "2", W/14, 4 * H/14, W/20, H/21 statictext #runtot.st5, "3", W/14, 5 * H/14, W/20, H/21 statictext #runtot.st6, "4", W/14, 6 * H/14, W/20, H/21 statictext #runtot.st7, "5", W/14, 7 * H/14, W/20, H/21 statictext #runtot.st8, "6", W/14, 8 * H/14, W/20, H/21 statictext #runtot.st9, "7", W/14, 9 * H/14, W/20, H/21 statictext #runtot.st10, "8", W/14, 10 * H/14, W/20, H/20 button #runtot.btn1, "1", one, UL, W/5 + 1 * W/12, H/20, W/20, H/15 button #runtot.btn2, "2", two, UL, W/5 + 2 * W/12, H/20, W/20, H/15 button #runtot.btn3, "3", three, UL, W/5 + 3 * W/12, H/20, W/20, H/15 button #runtot.btn4, "4", four, UL, W/5 + 4 * W/12, H/20, W/20, H/15 button #runtot.btn5, "5", five, UL, W/5 + 5 * W/12, H/20, W/20, H/15 button #runtot.btn6, "6", six, UL, W/5 + 6 * W/12, H/20, W/20, H/15 button #runtot.btn7, "7", seven, UL, W/5 + 7 * W/12, H/20, W/20, H/15 button #runtot.btn8, "8", eight, UL, W/5 + 8 * W/12, H/20, W/20, H/15 button #runtot.btn9, "Pick Winner", [dispwin], UL, W/3, 8*H/10, W/5, H/18 button #runtot.btn10, "Main Menu", [rntexit], UL, W/8, 8*H/10, W/5, H/18 button #runtot.btn11, "Show Odds", [rntupd], UL, W/1.8, 8*H/10, W/5, H/18 button #runtot.btn12, "Update Bets", [rntdbt], UL, W/1.3, 8*H/10, W/5, H/18 statictext #runtot.tb0, " ", W/8, H/20, W/15, H/16 statictext #runtot.tb21, " ", W/8, H/8, W/2.5, H/16 statictext #runtot.tb22, " ", W/1.9, H/8, W/2.5, H/16 statictext #runtot.tb1, " ", W/8, 3 * H/14, W/2.6, H/15 statictext #runtot.tb2, " ", W/8, 4 * H/14, W/2.6, H/15 statictext #runtot.tb3, " ", W/8, 5 * H/14, W/2.6, H/15 statictext #runtot.tb4, " ", W/8, 6 * H/14, W/2.6, H/15 statictext #runtot.tb5, " ", W/8, 7 * H/14, W/2.6, H/15 statictext #runtot.tb6, " ", W/8, 8 * H/14, W/2.6, H/15 statictext #runtot.tb7, " ", W/8, 9 * H/14, W/2.6, H/15 statictext #runtot.tb8, " ", W/8, 10 * H/14, W/2.6, H/15 statictext #runtot.st11, " ", W/1.9, 3 * H/14, W/4.5, H/15 statictext #runtot.st12, " ", W/1.9, 4 * H/14, W/4.5, H/15 statictext #runtot.st13, " ", W/1.9, 5 * H/14, W/4.5, H/15 statictext #runtot.st14, " ", W/1.9, 6 * H/14, W/4.5, H/15 statictext #runtot.st15, " ", W/1.9, 7 * H/14, W/4.5, H/15 statictext #runtot.st16, " ", W/1.9, 8 * H/14, W/4.5, H/15 statictext #runtot.st17, " ", W/1.9, 9 * H/14, W/4.5, H/15 statictext #runtot.st18, " ", W/1.9, 10 * H/14, W/4.5, H/15 textbox #runtot.tb11, W/1.2, 3 * H/14, W/9, H/15 textbox #runtot.tb12, W/1.2, 4 * H/14, W/9, H/15 textbox #runtot.tb13, W/1.2, 5 * H/14, W/9, H/15 textbox #runtot.tb14, W/1.2, 6 * H/14, W/9, H/15 textbox #runtot.tb15, W/1.2, 7 * H/14, W/9, H/15 textbox #runtot.tb16, W/1.2, 8 * H/14, W/9, H/15 textbox #runtot.tb17, W/1.2, 9 * H/14, W/9, H/15 textbox #runtot.tb18, W/1.2, 10 * H/14, W/9, H/15
open "RACENITE - Tote" for window as #runtot f$ = "font Arial_Black 0 "; int(H/16.5) print #runtot, f$ print #runtot, "trapclose [rntquit]"
#runtot.btn9 "!disable" #runtot.btn10 "!disable" #runtot.tb11 "!disable" #runtot.tb12 "!disable" #runtot.tb13 "!disable" #runtot.tb14 "!disable" #runtot.tb15 "!disable" #runtot.tb16 "!disable" #runtot.tb17 "!disable" #runtot.tb18 "!disable" #runtot.btn1, "!setfocus" answer$ = "one" : goto [keepFocus] [rntloop] input answer$ [keepFocus] input answer$ if answer$ = "one" then rc = 1 if answer$ = "two" then rc = 2 if answer$ = "three" then rc = 3 if answer$ = "four" then rc = 4 if answer$ = "five" then rc = 5 if answer$ = "six" then rc = 6 if answer$ = "seven" then rc = 7 if answer$ = "eight" then rc = 8
print #runtot.tb21, racnm$(rc) print #runtot.tb22, racsp$(rc) print #runtot.tb1, hornm$(rc,1) print #runtot.tb2, hornm$(rc,2) print #runtot.tb3, hornm$(rc,3) print #runtot.tb4, hornm$(rc,4) print #runtot.tb5, hornm$(rc,5) print #runtot.tb6, hornm$(rc,6) print #runtot.tb7, hornm$(rc,7) print #runtot.tb8, hornm$(rc,8)
rc$ = str$(rc) print #runtot.tb0, rc$ gosub [rntshwbts] #runtot.tb11 "!enable" #runtot.tb12 "!enable" #runtot.tb13 "!enable" #runtot.tb14 "!enable" #runtot.tb15 "!enable" #runtot.tb16 "!enable" #runtot.tb17 "!enable" #runtot.tb18 "!enable" #runtot.btn9 "!disable" #runtot.btn10 "!disable" #runtot.btn11 "!enable" #runtot.btn12 "!disable" #runtot.tb11 "!setfocus" goto [rntloop]
[rntupd] if rc = 0 then notice "No Race Selected" goto [rntloop] end if gosub [rntnwb] #runtot.btn11 "!disable" #runtot.btn12 "!enable" goto [rntodd]
[rntnwb] print #runtot.tb11, "!contents? bet$"; bets(rc, 1) = int(val(bet$)) print #runtot.tb12, "!contents? bet$"; bets(rc, 2) = int(val(bet$)) print #runtot.tb13, "!contents? bet$"; bets(rc, 3) = int(val(bet$)) print #runtot.tb14, "!contents? bet$"; bets(rc, 4) = int(val(bet$)) print #runtot.tb15, "!contents? bet$"; bets(rc, 5) = int(val(bet$)) print #runtot.tb16, "!contents? bet$"; bets(rc, 6) = int(val(bet$)) print #runtot.tb17, "!contents? bet$"; bets(rc, 7) = int(val(bet$)) print #runtot.tb18, "!contents? bet$"; bets(rc, 8) = int(val(bet$)) return
[rntodd] if roun$ = "F" then chk = unit/5 else chk = unit/10 end if gosub [gettot] if rc = 1 then tot = tot * pay1 tot = tot / 100 else tot = tot * payb tot = tot / 100 end if osb=999 fvb=0 for j =1 to 8 if bets(rc, j) > fvb then fvb = bets(rc, j) end if if bets(rc, j) < osb then osb = bets(rc, j) end if next j for j = 1 to 8 bts = bets(rc, j) bts = bts - less1 if bts = 0 then horod$(rc,j) = " " goto [endjloop] end if odds = (tot/bts)-1 if odds < 0 then horod$(rc,j) = "Stake only" goto [endjloop] end if on$ = "" if odds < 1 then odds = 1 / odds if odds > chk then horod$(rc,j) = "Stake only" goto [endjloop] end if on$ = " ON" end if if odds > 9 then od = int(odds) horod$(rc,j) = str$(od); ":1"; on$ else kodds = 1000*odds i = 0 odd = 0 while kodds > odd odd = val(mid$(num$, 1 + i*4, 4)) i = i + 1 wend odstr$ = mid$(odst$, 1+ ((i - 2) * 6), 6) horod$(rc,j) = odstr$; on$ end if if bets(rc, j) = osb then horod$(rc,j) = horod$(rc,j); " (O/S)" end if if bets(rc, j) = fvb then horod$(rc,j) = horod$(rc,j); " (Fav)" end if [endjloop] next j
print #runtot.st11, horod$(rc,1) print #runtot.st12, horod$(rc,2) print #runtot.st13, horod$(rc,3) print #runtot.st14, horod$(rc,4) print #runtot.st15, horod$(rc,5) print #runtot.st16, horod$(rc,6) print #runtot.st17, horod$(rc,7) print #runtot.st18, horod$(rc,8) print #runtot.tb11, "" print #runtot.tb12, "" print #runtot.tb13, "" print #runtot.tb14, "" print #runtot.tb15, "" print #runtot.tb16, "" print #runtot.tb17, "" print #runtot.tb18, "" #runtot.tb11 "!disable" #runtot.tb12 "!disable" #runtot.tb13 "!disable" #runtot.tb14 "!disable" #runtot.tb15 "!disable" #runtot.tb16 "!disable" #runtot.tb17 "!disable" #runtot.tb18 "!disable" #runtot.btn9 "!enable" #runtot.btn10 "!enable" goto [rntloop]
[rntdbt] gosub [rntshwbts] #runtot.tb11 "!enable" #runtot.tb12 "!enable" #runtot.tb13 "!enable" #runtot.tb14 "!enable" #runtot.tb15 "!enable" #runtot.tb16 "!enable" #runtot.tb17 "!enable" #runtot.tb18 "!enable" #runtot.btn11 "!enable" #runtot.btn12 "!disable" #runtot.btn10 "!disable" #runtot.btn9 "!disable" goto [rntloop]
[rntshwbts] print #runtot.tb11, bets(rc,1) print #runtot.tb12, bets(rc,2) print #runtot.tb13, bets(rc,3) print #runtot.tb14, bets(rc,4) print #runtot.tb15, bets(rc,5) print #runtot.tb16, bets(rc,6) print #runtot.tb17, bets(rc,7) print #runtot.tb18, bets(rc,8) print #runtot.st11, "" print #runtot.st12, "" print #runtot.st13, "" print #runtot.st14, "" print #runtot.st15, "" print #runtot.st16, "" print #runtot.st17, "" print #runtot.st18, "" return
[gettot] tot = 0 for j = 1 to 8 tot = tot + bets(rc, j) if bets(rc,j) >= less1 then tot = tot - less1 end if next j return
[rntquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #runtot end
[rntexit] close #runtot goto [start]
[dispwin] close #runtot statictext #dispwin.st0, "Race No", W/8, H/20, W/10, H/20 statictext #dispwin.st1, "Sponsored by", W/1.8, H/20, W/3, H/20 statictext #dispwin.st2, "Horse No", W/8, 4 * H/14, W/8, H/20 statictext #dispwin.st3, "Name", W/8, 5 * H/14, W/10, H/20 statictext #dispwin.st4, "Owner", W/8, 6 * H/14, W/10, H/20 statictext #dispwin.st5, "Payback", W/8, 7 * H/14, W/8, H/20 button #dispwin.btn9, "Show Winner", [dwnwin], UL, W/3, 8*H/10, W/5, H/18 button #dispwin.btn10, "Main Menu", [dwnexit], UL, W/8, 8*H/10, W/5, H/18 statictext #dispwin.tb0, "", W/4, H/20, W/15, H/16 statictext #dispwin.tb21, "", W/8, H/8, W/2.6, H/16 statictext #dispwin.tb22, "", W/1.9, H/8, W/2.6, H/16 statictext #dispwin.tb2, "", W/3, 5 * H/14, W/2, H/16 statictext #dispwin.tb3, "", W/3, 6 * H/14, W/2, H/16 textbox #dispwin.tb1, W/3, 4 * H/14, W/15, H/16 TextboxColor$ = "yellow" textbox #dispwin.tb4, W/3, 7 * H/14, W/4, H/16 TextboxColor$ = "white" open "RACENITE - Winner" for window as #dispwin f$ = "font Arial_Black 0 "; int(H/20) print #dispwin, f$ print #dispwin, "trapclose [dwnquit]"
rc$ = str$(rc) print #dispwin.tb0, rc$ print #dispwin.tb21, racnm$(rc) print #dispwin.tb22, racsp$(rc) [dspwinloop] print #dispwin.tb1, "!setfocus" wait
[dwnwin] print #dispwin.tb1, "!contents? hor$"; w = val(hor$) if w < 1 or w > 8 then notice "Horse No must be in range 1 to 8" goto [dspwinloop] end if winr(rc) = w print #dispwin.tb2, hornm$(rc,w) print #dispwin.tb3, horsp$(rc,w) gosub [getpb] py = pay(rc) print #dispwin.tb4, using("####.##",py/100); " PER TICKET" goto [dspwinloop]
[getpb] pb = 0 if w = 0 then return end if gosub [gettot] if tot = 0 then return end if if rc = 1 then tot = tot * pay1 else tot = tot * payb end if bts = bets(rc, w) bts = bts - less1 if bts = 0 then pb = 0 else pb = (tot * unit)/(bts * 100) if roun$ = "F" then pb = pb / 5 pb = int(pb) * 5 else pb = pb / 10 pb = int(pb) * 10 end if if pb < unit then pb = unit end if end if pay(rc) = pb return
[dwnquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #dispwin end
[dwnexit] close #dispwin goto [start]
[savdat] close #main statictext #savdat.st0, "DATA SAVING", W/3, 1, W/2, H/20 statictext #savdat.st1, "Do you really want to Save Data", W/4, H/12, W/2, H/20 button #savdat.btn1, "Yes", [savdsave], UL, W/4, H/5, W/10, H/15 button #savdat.btn2, "No - forget it!", [savdexit], UL, W/4, H/3, W/5, H/15
open "RACENITE - Data Savings" for window as #savdat f$ = "font Arial_Black 0 "; int(H/20) print #savdat, f$ print #savdat, "trapclose [sdtquit]"
wait
[savdsave] open filenm$ for output as #1 print #1, pay1 print #1, payb print #1, unit print #1, roun$ print #1, less1 for i = 1 to 9 print #1,winr(i) print #1,pay(i) next i for i = 1 to 9 for j = 1 to 8 print #1,bets(i,j) next j next i for i = 1 to 9 print #1,racnm$(i) print #1,racsp$(i) next i for i = 1 to 9 for j = 1 to 8 print #1,hornm$(i,j) print #1,horsp$(i,j) next j next i close #1 notice "Data Saved "
[savdexit] close #savdat goto [start]
[sdtquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #savdat end ' goto [start]
[loddat] close #main statictext #loddat.st0, "DATA SAVING", W/3, 1, W/2, H/20 statictext #loddat.st1, "Do you really want to Load Data", W/4, H/12, W/2, H/20 button #loddat.btn1, "Yes", [loddload], UL, W/4, H/5, W/10, H/15 button #loddat.btn2, "No - forget it!", [loddexit], UL, W/4, H/3, W/5, H/15
open "RACENITE - Data Loading" for window as #loddat f$ = "font Arial_Black 0 "; int(H/20) print #loddat, f$ print #loddat, "trapclose [ldtquit]" wait
[loddload] open filenm$ for input as #1 INPUT #1, txt$ pay1 = val(txt$) INPUT #1, txt$ payb = val(txt$) INPUT #1, txt$ unit = val(txt$) INPUT #1, txt$ roun$ = txt$ INPUT #1, txt$ less1 = val(txt$) for i = 1 to 9 INPUT #1, txt$ winr(i) = val(txt$) INPUT #1, txt$ pay(i) = val(txt$) next i for i = 1 to 9 for j = 1 to 8 INPUT #1, txt$ bets(i,j) = val(txt$) next j next i for i = 1 to 9 INPUT #1, txt$ racnm$(i) = txt$ INPUT #1, txt$ racsp$(i) = txt$ next i for i = 1 to 9 for j = 1 to 8 INPUT #1, txt$ hornm$(i,j) = txt$ INPUT #1, txt$ horsp$(i,j) = txt$ next j next i close #1 notice "Data Loaded "
[loddexit] close #loddat goto [start]
[ldtquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #loddat end
goto [start]
[prntres] close #main statictext #prntres.st0, "RESULTS PRINTING", W/3, 1, W/2, H/20 statictext #prntres.st1, "Do you really want to Print Data", W/4, H/12, W/2, H/20 button #prntres.btn1, "Yes", [prndat], UL, W/4, H/5, W/10, H/15 button #prntres.btn2, "No - forget it!", [prndatexit], UL, W/4, H/3, W/5, H/15
open "RACENITE - Data Loading" for window as #prntres f$ = "font Arial_Black 0 "; int(H/20) print #prntres, f$ print #prntres, "trapclose [prsquit]" wait
[prndat] tpd = 0 tnt = 0 tin = 0
lprint lprint " RACENITE RESULTS ANALYSIS "; date$() lprint lprint " Bet Unit:";using("###",unit);" Pay 1 %:";using("###",pay1); lprint " Payb 2-9 %:";using("###",payb);" St/No:";using("###",less1) lprint lprint " RC WIN SOLD PAYB PAID TOT INCOME PROFIT PERC" lprint for rc = 1 to 9 w = winr(rc) if w = 0 then bts = 0 py = 0 else bts = bets(rc,w) bts = bts - less1 py = pay(rc) end if gosub[gettot] if tot = 0 then pc = 0 net = 0 else net = tot * unit - py * bts pc = net *100 / (tot * unit) end if tpd = tpd + py * bts tin = tin + tot * unit tnt = tnt + net lprint using("####",rc);using("###",w);using("######",bts);using("#####.##", py/100); lprint using("#######.##",py * bts/100);using("#######",tot);using("#######.##",tot * unit / 100); lprint using("######.##",net / 100);using("####.##",pc) next rc lprint lprint " TOTALS ";using("####.##",tpd/100);" ";using("####.##",tin / 100); lprint " ";using("#####.##",tnt / 100) lprint dump
notice "Data sent to Printer - Press 'ENTER' " close #prntres goto [start]
[prndatexit] close #prntres goto [start]
[prsquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #prntres end goto [start]
[dispres] close #main statictext #dispres.st0, "RESULTS DISPLAY", W/3, 1, W/2, H/18 statictext #dispres.st1, "Bet Unit", W/28, H/12, W/2, H/18 statictext #dispres.st2, "Pay 1 %", W/4.5, H/12, W/2, H/18 statictext #dispres.st3, "Pay 2-9 %", W/2.2, H/12, W/2, H/18 statictext #dispres.st4, "St No", W/1.5, H/12, W/2, H/18
statictext #dispres.tb1, " ", W/28 + 150, H/12, W/20, H/18 statictext #dispres.tb2, " ", W/4 + 150, H/12, W/20, H/18 statictext #dispres.tb3, " ", W/2 + 150, H/12, W/20, H/18 statictext #dispres.tb4, " ", W/1.4 + 100, H/12, W/20, H/18
statictext #dispres.st11, "Race", W/28, H/7, W/15, H/18 statictext #dispres.st12, "Win", W/8.5, H/7, W/15, H/18 statictext #dispres.st13, "Sold", W/5.12, H/7, W/15, H/18 statictext #dispres.st14, "P'back", W/3.6, H/7, W/15, H/18 statictext #dispres.st15, "Paid", W/2.8, H/7, W/15, H/18 statictext #dispres.st16, "Total", W/2.3, H/7, W/15, H/18 statictext #dispres.st17, "Income", W/1.96, H/7, W/15, H/18 statictext #dispres.st18, "Profit", W/1.7, H/7, W/15, H/18 statictext #dispres.st19, "Perc", W/1.5, H/7, W/15, H/18
statictext #dispres.tb11, " ", W/28, 3 * H/14, W/15, H/18 statictext #dispres.tb12, " ", W/8.5, 3 * H/14, W/15, H/18 statictext #dispres.tb13, " ", W/5.12, 3 * H/14, W/15, H/18 statictext #dispres.tb14, " ", W/3.6, 3 * H/14, W/15, H/18 statictext #dispres.tb15, " ", W/2.8, 3 * H/14, W/15, H/18 statictext #dispres.tb16, " ", W/2.3, 3 * H/14, W/15, H/18 statictext #dispres.tb17, " ", W/1.96, 3 * H/14, W/15, H/18 statictext #dispres.tb18, " ", W/1.7, 3 * H/14, W/15, H/18 statictext #dispres.tb19, " ", W/1.5, 3 * H/14, W/15, H/18
statictext #dispres.tb21, " ", W/28, 4 * H/14, W/15, H/18 statictext #dispres.tb22, " ", W/8.5, 4 * H/14, W/15, H/18 statictext #dispres.tb23, " ", W/5.12, 4 * H/14, W/15, H/18 statictext #dispres.tb24, " ", W/3.6, 4 * H/14, W/15, H/18 statictext #dispres.tb25, " ", W/2.8, 4 * H/14, W/15, H/18 statictext #dispres.tb26, " ", W/2.3, 4 * H/14, W/15, H/18 statictext #dispres.tb27, " ", W/1.96, 4 * H/14, W/15, H/18 statictext #dispres.tb28, " ", W/1.7, 4 * H/14, W/15, H/18 statictext #dispres.tb29, " ", W/1.5, 4 * H/14, W/15, H/18
statictext #dispres.tb31, " ", W/28, 5 * H/14, W/15, H/18 statictext #dispres.tb32, " ", W/8.5, 5 * H/14, W/15, H/18 statictext #dispres.tb33, " ", W/5.12, 5 * H/14, W/15, H/18 statictext #dispres.tb34, " ", W/3.6, 5 * H/14, W/15, H/18 statictext #dispres.tb35, " ", W/2.8, 5 * H/14, W/15, H/18 statictext #dispres.tb36, " ", W/2.3, 5 * H/14, W/15, H/18 statictext #dispres.tb37, " ", W/1.96, 5 * H/14, W/15, H/18 statictext #dispres.tb38, " ", W/1.7, 5 * H/14, W/15, H/18 statictext #dispres.tb39, " ", W/1.5, 5 * H/14, W/15, H/18
statictext #dispres.tb41, " ", W/28, 6 * H/14, W/15, H/18 statictext #dispres.tb42, " ", W/8.5, 6 * H/14, W/15, H/18 statictext #dispres.tb43, " ", W/5.12, 6 * H/14, W/15, H/18 statictext #dispres.tb44, " ", W/3.6, 6 * H/14, W/15, H/18 statictext #dispres.tb45, " ", W/2.8, 6 * H/14, W/15, H/18 statictext #dispres.tb46, " ", W/2.3, 6 * H/14, W/15, H/18 statictext #dispres.tb47, " ", W/1.96, 6 * H/14, W/15, H/18 statictext #dispres.tb48, " ", W/1.7, 6 * H/14, W/15, H/18 statictext #dispres.tb49, " ", W/1.5, 6 * H/14, W/15, H/18
statictext #dispres.tb51, " ", W/28, 7 * H/14, W/15, H/18 statictext #dispres.tb52, " ", W/8.5, 7 * H/14, W/15, H/18 statictext #dispres.tb53, " ", W/5.12, 7 * H/14, W/15, H/18 statictext #dispres.tb54, " ", W/3.6, 7 * H/14, W/15, H/18 statictext #dispres.tb55, " ", W/2.8, 7 * H/14, W/15, H/18 statictext #dispres.tb56, " ", W/2.3, 7 * H/14, W/15, H/18 statictext #dispres.tb57, " ", W/1.96, 7 * H/14, W/15, H/18 statictext #dispres.tb58, " ", W/1.7, 7 * H/14, W/15, H/18 statictext #dispres.tb59, " ", W/1.5, 7 * H/14, W/15, H/18
statictext #dispres.tb61, " ", W/28, 8 * H/14, W/15, H/18 statictext #dispres.tb62, " ", W/8.5, 8 * H/14, W/15, H/18 statictext #dispres.tb63, " ", W/5.12, 8 * H/14, W/15, H/18 statictext #dispres.tb64, " ", W/3.6, 8 * H/14, W/15, H/18 statictext #dispres.tb65, " ", W/2.8, 8 * H/14, W/15, H/18 statictext #dispres.tb66, " ", W/2.3, 8 * H/14, W/15, H/18 statictext #dispres.tb67, " ", W/1.96, 8 * H/14, W/15, H/18 statictext #dispres.tb68, " ", W/1.7, 8 * H/14, W/15, H/18 statictext #dispres.tb69, " ", W/1.5, 8 * H/14, W/15, H/18
statictext #dispres.tb71, " ", W/28, 9 * H/14, W/15, H/18 statictext #dispres.tb72, " ", W/8.5, 9 * H/14, W/15, H/18 statictext #dispres.tb73, " ", W/5.12, 9 * H/14, W/15, H/18 statictext #dispres.tb74, " ", W/3.6, 9 * H/14, W/15, H/18 statictext #dispres.tb75, " ", W/2.8, 9 * H/14, W/15, H/18 statictext #dispres.tb76, " ", W/2.3, 9 * H/14, W/15, H/18 statictext #dispres.tb77, " ", W/1.96, 9 * H/14, W/15, H/18 statictext #dispres.tb78, " ", W/1.7, 9 * H/14, W/15, H/18 statictext #dispres.tb79, " ", W/1.5, 9 * H/14, W/15, H/18
statictext #dispres.tb81, " ", W/28, 10 * H/14, W/15, H/18 statictext #dispres.tb82, " ", W/8.5, 10 * H/14, W/15, H/18 statictext #dispres.tb83, " ", W/5.12,10 * H/14, W/15, H/18 statictext #dispres.tb84, " ", W/3.6, 10 * H/14, W/15, H/18 statictext #dispres.tb85, " ", W/2.8, 10 * H/14, W/15, H/18 statictext #dispres.tb86, " ", W/2.3, 10 * H/14, W/15, H/18 statictext #dispres.tb87, " ", W/1.96, 10 * H/14, W/15, H/18 statictext #dispres.tb88, " ", W/1.7, 10 * H/14, W/15, H/18 statictext #dispres.tb89, " ", W/1.5, 10 * H/14, W/15, H/18
statictext #dispres.st93, "Totals", W/5.12, 11.2 * H/14, W/15, H/18 statictext #dispres.tb95, " ", W/2.8, 11.2 * H/14, W/15, H/18 statictext #dispres.tb97, " ", W/1.96, 11.2 * H/14, W/15, H/18 statictext #dispres.tb98, " ", W/1.7, 11.2 * H/14, W/15, H/18
button #dispres.btn10, "Main Menu", [drsexit], UL, W/1.3, 4*H/10, W/7, H/18
open "RACENITE - Result Display" for window as #dispres f$ = "font Arial_Black 0 "; int(H/29) print #dispres, f$ print #dispres, "trapclose [drsquit]"
print #dispres.tb1, unit print #dispres.tb2, pay1 print #dispres.tb3, payb print #dispres.tb4, less1
tpd = 0 tin = 0 tnt = 0
rc = 1 w = winr(rc) gosub [anal] print #dispres.tb11, rc print #dispres.tb12, w print #dispres.tb13, bts print #dispres.tb14, using("###.##",py/100) print #dispres.tb15, using("####.##",py * bts/100) print #dispres.tb16, using("####",tot) print #dispres.tb17, using("####.##",tot * unit / 100) print #dispres.tb18, using("####.##",net / 100) print #dispres.tb19, using("###.##",pc)
rc = 2 w = winr(rc) gosub [anal] print #dispres.tb21, rc print #dispres.tb22, w print #dispres.tb23, bts print #dispres.tb24, using("###.##",py/100) print #dispres.tb25, using("####.##",py * bts/100) print #dispres.tb26, using("####",tot) print #dispres.tb27, using("####.##",tot * unit / 100) print #dispres.tb28, using("####.##",net / 100) print #dispres.tb29, using("###.##",pc)
rc = 3 w = winr(rc) gosub [anal] print #dispres.tb31, rc print #dispres.tb32, w print #dispres.tb33, bts print #dispres.tb34, using("###.##",py/100) print #dispres.tb35, using("####.##",py * bts/100) print #dispres.tb36, using("####",tot) print #dispres.tb37, using("####.##",tot * unit / 100) print #dispres.tb38, using("####.##",net / 100) print #dispres.tb39, using("###.##",pc)
rc = 4 w = winr(rc) gosub [anal] print #dispres.tb41, rc print #dispres.tb42, w print #dispres.tb43, bts print #dispres.tb44, using("###.##",py/100) print #dispres.tb45, using("####.##",py * bts/100) print #dispres.tb46, using("####",tot) print #dispres.tb47, using("####.##",tot * unit / 100) print #dispres.tb48, using("####.##",net / 100) print #dispres.tb49, using("###.##",pc)
rc = 5 w = winr(rc) gosub [anal] print #dispres.tb51, rc print #dispres.tb52, w print #dispres.tb53, bts print #dispres.tb54, using("###.##",py/100) print #dispres.tb55, using("####.##",py * bts/100) print #dispres.tb56, using("####",tot) print #dispres.tb57, using("####.##",tot * unit / 100) print #dispres.tb58, using("####.##",net / 100) print #dispres.tb59, using("###.##",pc)
rc = 6 w = winr(rc) gosub [anal] print #dispres.tb61, rc print #dispres.tb62, w print #dispres.tb63, bts print #dispres.tb64, using("###.##",py/100) print #dispres.tb65, using("####.##",py * bts/100) print #dispres.tb66, using("####",tot) print #dispres.tb67, using("####.##",tot * unit / 100) print #dispres.tb68, using("####.##",net / 100) print #dispres.tb69, using("###.##",pc)
rc = 7 w = winr(rc) gosub [anal] print #dispres.tb71, rc print #dispres.tb72, w print #dispres.tb73, bts print #dispres.tb74, using("###.##",py/100) print #dispres.tb75, using("####.##",py * bts/100) print #dispres.tb76, using("####",tot) print #dispres.tb77, using("####.##",tot * unit / 100) print #dispres.tb78, using("####.##",net / 100) print #dispres.tb79, using("###.##",pc)
rc = 8 w = winr(rc) gosub [anal] print #dispres.tb81, rc print #dispres.tb82, w print #dispres.tb83, bts print #dispres.tb84, using("###.##",py/100) print #dispres.tb85, using("####.##",py * bts/100) print #dispres.tb86, using("####",tot) print #dispres.tb87, using("####.##",tot * unit / 100) print #dispres.tb88, using("####.##",net / 100) print #dispres.tb89, using("###.##",pc)
print #dispres.tb95, using("####.##",tpd/100) print #dispres.tb97, using("####.##",tin/100) print #dispres.tb98, using("####.##",tnt/100)
wait
[drsexit] close #dispres goto [start]
[drsquit] confirm "Really Quit?"; answer$ if answer$ <> "yes" then wait close #dispres end
goto [start]
[anal] ' calculate payback for race and update overall totals if w = 0 then bts = 0 py = 0 else bts = bets(rc,w) bts = bts - less1 py = pay(rc) end if gosub[gettot] if tot = 0 then pc = 0 net = 0 else net = tot * unit - py * bts pc = net *100 / (tot * unit) end if tpd = tpd + py * bts tin = tin + tot * unit tnt = tnt + net return
jbHelpSearch - by cundo
'JB v2.0 Help and Tutorial Search 'Created by cundo - Editted by xxgeek - added Tutorial Search
global q$, fileToCheck$, helpFilePath$, resetsearch JBpath$ = "c:\Program Files (x86)\Just Basic v2.0" tutorialPath$ = JBpath$;"\jbtutorial\index.html" openhelp$ = JBpath$;"\jb2help\JustBASIC_2_web\amber_menu.htm" helpFilePath$ = JBpath$;"\jb2help\JustBASIC_2_web" : helpFileMenu$ = "amber_menu.htm"
nomainwin WindowWidth = 700:WindowHeight = 580 UpperLeftX= int((DisplayWidth-WindowWidth)/2) UpperLeftY= int((DisplayHeight-WindowHeight)/2) BackgroundColor$ = "lightgray" ForegroundColor$ = "black"
[resetsearch] if resetsearch = 1 then count = 0 : startAt = 0 : idx = 0 : hrefA = 0 : hrefB = 0 : a = 0 : b = 0 : c = 0 dim helpList$(500), searchList$(500) open helpFilePath$;"\";helpFileMenu$ for input as #1 txt$ = input$(#1, lof(#1)) close #1 lowerTxt$= lower$(txt$) while 1 scan startAt = c+1 a = instr(lowerTxt$, "href",startAt) b = instr(lowerTxt$, ">",a+1) c = instr(lowerTxt$, "</a>",b+1) if a=0 or b=0 or c= 0 then exit while hrefA= instr(lowerTxt$,chr$(34),a+1) hrefB= instr(lowerTxt$,chr$(34),hrefA+1) idx = idx +1 helpList$(idx)= trim$(mid$(txt$,b+1,c-b-1));chr$(0);_ trim$(mid$(txt$,hrefA+1,hrefB-hrefA-1)) wend
if resetsearch = 1 then [reloadSearchLists]
'jbsearch by cundo listbox #main.listbox1, helpList$(, lbDoubleClick, 20, 80, 325, 410 statictext #main.searchtext, "Search For KeyWord(s)", 355, 40, 160, 20 statictext #main.searchheader, "Just Basic v2.0 Help and Tutorial Search", 200, 7, 360, 20 statictext #main.searchin, "Search in >>", 23, 41, 85, 20 statictext #main.clickTip1, "Single Click to Select", 120, 67, 170, 15 statictext #main.clickTip2, "Single Click to Select", 435, 102, 170, 15 statictext #main.or, " or", 210, 38, 20, 20 textbox #main.tb, 510, 35, 155, 25 listbox #main.listbox2, searchList$(, lbDoubleClick, 345, 115, 325, 370 button #main.search, "&Start Searching in JB Help", buttonClick, UL, 400, 70, 220, 25 button #main.contents, "&JB Help File", [helpfiles], UL, 110, 35, 90, 25 button #main.tutorial, "JB Tuto&rial", [tutorial], UL, 245, 35, 90, 25 button #main.tutorial, "Open JB Tutoria&l", [opentutorial], UL, 185, 505, 120, 20
button #main.openhelp, "Open JB Help", [openhelp], UL, 55, 505, 120, 20
open "JBSearch by cundo" for window as #main
#main "trapclose [quit.main]"
#main.listbox1 "singleclickselect" #main.listbox2 "singleclickselect" #main "font arial 10 Bold" #main.listbox1, "font arial 12 bold" #main.listbox2, "font arial 12 bold" #main.clickTip1, "!font arial 8 bold" #main.clickTip2, "!font arial 8 bold" #main.searchin, "!font arial 12 bold" #main.search, "!font arial 12 bold" #main.searchheader, "!font arial 12 bold" #main.tb, "!setfocus"
'reload search and help lists if selected path changes from Help to Tutorial [reloadSearchLists] 'wait here for input event if resetsearch = 1 then #main.listbox1, "reload" #main.listbox2, "reload" resetsearch = 0 #main.tb, "!setfocus" end if wait
'xxgeek code [tutorial] resetsearch = 1 : helpFilePath$ = JBpath$;"\jbtutorial" helpFileMenu$ = "index.html" : #main.search, "&Start Searching JB Tutorial " : goto [resetsearch]
[helpfiles] resetsearch = 1 : helpFilePath$ = JBpath$;"\jb2help\JustBASIC_2_web" helpFileMenu$ = "amber_menu.htm" #main.search, "&Start Searching in JB Help" goto [resetsearch]
[openhelp] if fileExists(DefaultDir$, "htmlviewer.exe") <> 0 then run "htmlviewer.exe ";openhelp$ else run "explorer.exe ";openhelp$ end if wait
[opentutorial] if fileExists(DefaultDir$, "htmlviewer.exe") <> 0 then run "htmlviewer.exe ";tutorialPath$ else run "explorer.exe ";tutorialPath$ end if wait
[forumlink] run "explorer.exe https://justbasiccom.proboards.com/" wait
'quit program, save the current selected List first, and kill all htmlviewer 'windows if User chose to as well [quit.main] close #main end
'the following are cundo's jbsearch code edited by xxgeek 'subroutine to search selection Help, and or Tutorial sub buttonClick h2$ select case word$(h2$,2,".") case "search" #main.tb "!setfocus" #main.tb "!contents? searchFor$" searchFor$=trim$(searchFor$) if len(searchFor$)>2 then cursor hourglass redim searchList$(1000) for i = 1 to 1000 ' so so if helpList$(i)="" then result$ = "yes" #main.tb "!setfocus" : exit for end if fileToOpen$= word$(helpList$(i),2,chr$(0)) print helpFilePath$; " "; fileToOpen$ if fileToOpen$ = "http://www.justbasic.com" then fileToOpen$ = "index.html" open helpFilePath$; "\"; fileToOpen$ for input as #2 contents$ = input$(#2, lof(#2)) if instr(lower$(contents$), lower$(searchFor$)) then count=count+1 searchList$(count)= helpList$(i) end if close #2 next i if count = 0 then prompt "No Entries Found for " + chr$(13) + searchFor$ + " TRY AGAIN?" ; result$ sort searchList$(), 0, count #main.listbox2 "reload" cursor normal else result$ = "yes" prompt " 3 Character Minimum"+chr$(13) +" TRY AGAIN?";result$ end if end select end sub
'subroutine to open selected search item in a browser (htmlviewer if exists\default if not) sub lbDoubleClick h2$ #h2$ "selection? selection$" if selection$ = "" then exit sub fileToOpen$= word$( selection$,2,chr$(0)) if fileToOpen$ = "http://www.justbasic.com" then run "explorer.exe ";fileToOpen$ : wait fileToOpen$=replace$( fileToOpen$ , "/", "\" ) if fileExists(DefaultDir$, "htmlviewer.exe") <> 0 then print "fileToOpen$ = ";helpFilePath$;"\";fileToOpen$ 'for testing with mainwin run "htmlviewer.exe ";helpFilePath$;"\";fileToOpen$ #h2$ "select 0" else run "explorer.exe ";helpFilePath$;"\";fileToOpen$ #h2$ "select 0" end if end sub
function replace$( text$ , this$, tothis$ ) while 1 if instr(text$, this$) then f = instr(text$, this$) lenght=len(this$) text$ = mid$(text$,1,f-1);_ tothis$;mid$(text$,f+lenght) else exit while end if wend replace$=text$ end function
'function for checking file existence function fileExists(path$, filename$) dim info$(0, 0) files path$, filename$, info$() fileExists = val(info$(0, 0)) 'non zero is true end function
|
|