Post by milfredo on Jul 24, 2020 1:29:10 GMT -5
I run the following code and it works fine. But when I close the #top window, I get an error in debug mode that say Invalid File Handle #top.track1 I don't understand why. And if I comment out the line with that then the error moves to the very next line with #top in it.
[setup.top.Window]
'-----Begin code for #top
'nomainwin
WindowWidth = 1200
WindowHeight = 920
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=10
Dim a$(16)'
Dim b$(500)
ranknumber = 0
b$(1) = "analysts"
BackgroundColor$ = "darkblue"
combobox #top.combo2, b$(), [combox2], 300, 115, 300, 100 ' analysts combobox
TextboxColor$ = "lightgray"
'textbox #top.textbox7, 25, 89, 100, 25
button #top.button31,"Handi's Projrct",[sprintmast], UL, 100, 75, 125, 25
button #top.buttont1,"Print Current Race ",[trackoneraceoneprint], UL, 526, 33, 156, 25
button #top.buttont2,"Print CSV File ",[CSVPrint], UL, 526, 68, 156, 25
graphicbox #top.track1, 0, 152, 1190, 800
' radiobutton #top.radiobutton19, "T-1", [radiobutton19Set], [radiobutton19Reset], 134, 115, 40, 25
' button #top.buttont1,"Print Current Race T1",[trackoneraceoneprint], UL, 506, 33, 156, 25
button #top.buttontcalc, "Activate Dutchman", [dutchmancalc], UL, 940, 33, 150, 25
button #top.rawnum, "Raw Numbers", [rawselected],UL, 25, 35, 100, 25
button #top.ranknum, "Rank Numbers", [rankselected],UL, 200, 35, 100, 25
button #top.consensusadd, "Add Consensus Analyst", [selconsensus], UL, 700, 80, 200, 25
button #top.analystchange, "Change Analyst Current Race", [changeanalystcurrentrace],UL, 700, 115, 200, 25
button #top.consensus, "Open Consensus", [consensuswindow],UL, 970, 115, 200, 25
button #top.consensus, "Pace Pressure Guage", [Pacewindow],UL, 970, 80, 200, 25
open "Handifast Version 12.0" for graphics_nsb as #top
print #top, "down;fill 37 43 235 ; flush"
print #top, "color black; backcolor 37 43 235 "
print #top, "font ms_sans_serif 10 bold"
print #top, "color white"
print #top, "font ms_sans_serif 14"
print #top, "color white"
print #top, "place 900 24"
print #top, "\The Dutchman Calculator"
print #top, "place 25 24"
print #top, "\Select Raw or Rank Numbers for Display."
print #top.buttont1, "!font ms_sans_serif 10 bold"
print #top, "trapclose [quit.top]"
print #top, "size 4"
print #top, "line 01 145 1190 145"
print #top, "down"
print #top, "font ms_sans_serif 14"
print #top, "color 255 128 0 Bold"
print #top, "place 418 24"
print #top, "\ The H.H. Wood's HandiFast Program"
print #top, "place 375 100"
print #top, "color white"
print #top, "\ Race Analysts"
print #top.analystchange, "!hide"
print #top.consensusadd, "!hide"
print #top, "Flush"
analystsRAF = 1
gettrim #CompleteAnalystcontrol , 1 ' number of analysts in total
' control number for when RAF matches to load new RAF
redim a$(totalracesone+1)
a$(0) = "Race"
for i = 1 to totalracesone
a$(i) = "Race "+ STR$(i)
next i
trkone = 1
print #top, "color white; backcolor 37 43 235 "
contendersonly$ = "no" 'making default all horses
[goonwithrace]
goto [trk1races]
[top.inputLoop] 'wait here for input event
wait
[quit.top]
close #top
'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
[trk1races]
#top.track1 "when leftButtonDouble [leftdoubleclick]"
********************THIS IS WHERE THE ERROR SHOWS UP.
print #top, "place 415 130"
print #top, "backcolor blue"
print #top, "color blue"
print #top, "circlefilled 7"
print #top.analystchange, "!hide" ' hide change button between races.
print #top.consensusadd, "!hide"
h = horsescontrol ' holds total number of horses in race
[setup.top.Window]
'-----Begin code for #top
'nomainwin
WindowWidth = 1200
WindowHeight = 920
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=10
Dim a$(16)'
Dim b$(500)
ranknumber = 0
b$(1) = "analysts"
BackgroundColor$ = "darkblue"
combobox #top.combo2, b$(), [combox2], 300, 115, 300, 100 ' analysts combobox
TextboxColor$ = "lightgray"
'textbox #top.textbox7, 25, 89, 100, 25
button #top.button31,"Handi's Projrct",[sprintmast], UL, 100, 75, 125, 25
button #top.buttont1,"Print Current Race ",[trackoneraceoneprint], UL, 526, 33, 156, 25
button #top.buttont2,"Print CSV File ",[CSVPrint], UL, 526, 68, 156, 25
graphicbox #top.track1, 0, 152, 1190, 800
' radiobutton #top.radiobutton19, "T-1", [radiobutton19Set], [radiobutton19Reset], 134, 115, 40, 25
' button #top.buttont1,"Print Current Race T1",[trackoneraceoneprint], UL, 506, 33, 156, 25
button #top.buttontcalc, "Activate Dutchman", [dutchmancalc], UL, 940, 33, 150, 25
button #top.rawnum, "Raw Numbers", [rawselected],UL, 25, 35, 100, 25
button #top.ranknum, "Rank Numbers", [rankselected],UL, 200, 35, 100, 25
button #top.consensusadd, "Add Consensus Analyst", [selconsensus], UL, 700, 80, 200, 25
button #top.analystchange, "Change Analyst Current Race", [changeanalystcurrentrace],UL, 700, 115, 200, 25
button #top.consensus, "Open Consensus", [consensuswindow],UL, 970, 115, 200, 25
button #top.consensus, "Pace Pressure Guage", [Pacewindow],UL, 970, 80, 200, 25
open "Handifast Version 12.0" for graphics_nsb as #top
print #top, "down;fill 37 43 235 ; flush"
print #top, "color black; backcolor 37 43 235 "
print #top, "font ms_sans_serif 10 bold"
print #top, "color white"
print #top, "font ms_sans_serif 14"
print #top, "color white"
print #top, "place 900 24"
print #top, "\The Dutchman Calculator"
print #top, "place 25 24"
print #top, "\Select Raw or Rank Numbers for Display."
print #top.buttont1, "!font ms_sans_serif 10 bold"
print #top, "trapclose [quit.top]"
print #top, "size 4"
print #top, "line 01 145 1190 145"
print #top, "down"
print #top, "font ms_sans_serif 14"
print #top, "color 255 128 0 Bold"
print #top, "place 418 24"
print #top, "\ The H.H. Wood's HandiFast Program"
print #top, "place 375 100"
print #top, "color white"
print #top, "\ Race Analysts"
print #top.analystchange, "!hide"
print #top.consensusadd, "!hide"
print #top, "Flush"
analystsRAF = 1
gettrim #CompleteAnalystcontrol , 1 ' number of analysts in total
' control number for when RAF matches to load new RAF
redim a$(totalracesone+1)
a$(0) = "Race"
for i = 1 to totalracesone
a$(i) = "Race "+ STR$(i)
next i
trkone = 1
print #top, "color white; backcolor 37 43 235 "
contendersonly$ = "no" 'making default all horses
[goonwithrace]
goto [trk1races]
[top.inputLoop] 'wait here for input event
wait
[quit.top]
close #top
'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
[trk1races]
#top.track1 "when leftButtonDouble [leftdoubleclick]"
********************THIS IS WHERE THE ERROR SHOWS UP.
print #top, "place 415 130"
print #top, "backcolor blue"
print #top, "color blue"
print #top, "circlefilled 7"
print #top.analystchange, "!hide" ' hide change button between races.
print #top.consensusadd, "!hide"
h = horsescontrol ' holds total number of horses in race