Post by tsh73 on Nov 22, 2023 4:04:21 GMT -5
Inspired by this
libertybasiccom.proboards.com/thread/2454/graphics-window-menu-bar
thead.
With native commands.
Probably could be made simpler - since I could not make actual button to work,
could as well just draw gathered bitmap in a single graphicbox.
(or could use bit of API and get mouse coords under the button, hense making it work with real button.)
libertybasiccom.proboards.com/thread/2454/graphics-window-menu-bar
thead.
With native commands.
Probably could be made simpler - since I could not make actual button to work,
could as well just draw gathered bitmap in a single graphicbox.
(or could use bit of API and get mouse coords under the button, hense making it work with real button.)
nomainwin
WindowWidth = 550
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
graphicbox #main.gr0, 26, 16, 152, 65
graphicbox #main.gr, 0, 0,WindowWidth,WindowHeight
button #main.button1, "Click me if you can!", [button1Click], UL, 26, 16, 152, 65
open "Running button prank" for window_nf as #main
print #main, "trapclose [quit.main]"
print #main.gr, "down; fill buttonface; flush"
print #main.gr, "home; posxy cx cy"
print #main.gr, "when mouseMove [move]"
print #main.gr0, "down; fill cyan; flush"
print #main.gr0, "when mouseMove [move0]"
print #main.gr0, "when leftButtonDown [button1Click]" 'make fake button clicable
#main.gr0, "getbmp bmp 0 0 152, 65" 'cannot get mouse move under button. So use picture of a button instead
#main.gr0, "drawbmp bmp 0 0 "
#main.gr0, "flush"
#main.button1,"!hide"
wait
[quit.main]
Close #main
END
[button1Click] 'Perform action for the button named 'button1'
notice "Congrats!"+chr$(13)+"You got me!"
'#main.button1, "!locate 100 100 152 65" 'is hidden anyway
'#main.gr0, "locate 100 100 152 65"
'#main "refresh"
wait
[move]
'#main.gr, "\";MouseX;" ";MouseY
wait
[move0]
'#main.gr, "\";MouseX;" ";MouseY
'move that fake button
newX=int(rnd(0)*(2*cx-152))
newY=int(rnd(0)*(2*cy-65))
#main.gr0, "locate ";newX;" ";newY;" 152 65"
#main "refresh"
wait