antgurevich
New Member
I am currently self-teaching myself JustBASIC because I want to go into the programmng field. (:
Posts: 2
|
Post by antgurevich on Apr 12, 2019 0:32:07 GMT
Trying to insert a graphicsbox in my program, but I keep getting a error that "invalid file handle: #main.gbox"
WindowWidth = 600
WindowHeight = 480
BackgroundColor$ = "white"
ForegroundColor$ = "black"
IntroMsg1$ = "Welcome to the Rainbow Six Siege Alpha Pack Simulator"
statictext #main.statictext1, IntroMsg1$, 135, 50, 330, 32
loadbmp "pack", "Pack.bmp"
graphicbox #main.gbox, 155, 100, 200, 200
print #main.gbox, "flush"
print #main.gbox, "drawbmp pack 1 1"
print #main.gbox, "flush"
button #main.button "Play", PrepareGame, UL, 220, 360
button #main.button2 "Quit", CloseMain, UL, 305, 360
open "Main Menu" for window as #main
print #main, "trapclose TrapClose1"
wait
|
|
|
Post by Rod on Apr 12, 2019 7:10:23 GMT
You need to open the window and graphicbox resource before you send it commands. So move your print statements below the open window statement.
|
|
|
Post by tsh73 on Apr 12, 2019 9:02:20 GMT
Also please use code tags for your program ("C" on a button) or put them manually (just without spaces)
Added missing subs.
nomainwin 'you don't need that console window, are you?
WindowWidth = 600 WindowHeight = 480 BackgroundColor$ = "white" ForegroundColor$ = "black"
IntroMsg1$ = "Welcome to the Rainbow Six Siege Alpha Pack Simulator" statictext #main.statictext1, IntroMsg1$, 135, 50, 330, 32
'loadbmp "pack", "Pack.bmp" loadbmp "pack", "bmp\CHERRY.bmp" graphicbox #main.gbox, 155, 100, 200, 200
button #main.button "Play", PrepareGame, UL, 220, 360 button #main.button2 "Quit", CloseMain, UL, 305, 360
open "Main Menu" for window as #main
print #main, "trapclose TrapClose1" print #main.gbox, "flush" print #main.gbox, "drawbmp pack 1 1" print #main.gbox, "flush"
wait
'-------------------------------- 'missed sub TrapClose1 handle$ timer 0 'just for a case close #handle$ end end sub
sub PrepareGame handle$ notice "To be done" end sub
sub CloseMain handle$ 'that would be button handle, that is "#main.button2" call TrapClose1 "#main" end sub
|
|