Post by tsh73 on Nov 22, 2023 8:59:10 GMT
Rules are simple.
There is a button on a form.
Click it if you can!
(of cource I cheated. I was not able to get mouseMove event under tha button,
so I grabbed real button image and use it in a second graphicbox.
But I handled leftMouseDown, so you indeed *can* get a registered click!
(I got it once)
)
There is a button on a form.
Click it if you can!
(of cource I cheated. I was not able to get mouseMove event under tha button,
so I grabbed real button image and use it in a second graphicbox.
But I handled leftMouseDown, so you indeed *can* get a registered click!
(I got it once)
)
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