Code: Select all
MakeButton(1, #SIMPLEBUTTON, 100, 100, 100, 100, {OnMouseUp=Function() TestText = "A" EndFunction})
MakeButton(2, #SIMPLEBUTTON, 300, 100, 100, 100, {OnMouseUp=Function() TestText = "B" EndFunction})
SetInterval(1, Function()
Cls(0)
Box(100, 100, 100, 100, #WHITE)
Box(300, 100, 100, 100, #RED)
TextOut(200, 300, TestText, #WHITE)
Flip()
EndFunction, 25)
TestText="C"
BeginDoubleBuffer()
Repeat
WaitEvent()
Forever
But, if you move your mousepointer outside of the box, then push LEFT MOUSE down outside of the box, then move it on top of the button, and then release it for "OnMouseUp" to happen, then it doesn't react.
For "OnMouseUp"-event to trigger, mouse has to be above the button the whole time, from MOUSE DOWN, to MOUSE UP, or "OnMouseUp" wont trigger.
This is first of all unintuitive. Why name "OnMouseUp" when it doesn't actually mean it.
But more importantly, this is right now a problem for me which might need me make a lot of extra code, for what I was wishing to do was that since I have these "Rooms" in my editor, I was wanting to connect them together by simply pushing LEFT MOUSE DOWN on top of ROOM A, and then while keeping MOUSE DOWN, drag pointer above ROOM B and RELEASE the LEFT MOUSE BUTTON, and this way trigger "OnMouseUp" and tell they are now connected together.
However, since this behavior does not trigger "OnMouseUp" on ROOM B-button, I obviously cannot do it the simple way I meant, but now have to make code to figure out if it is above the other button or not.
Therefore a wish: Make "OnMouseUp" actually trigger when it is done above the button, no matter how it got there.
And second wish: Do make another "OnMouseUp" that works the way it currently does, it can be useful in some cases too.