Page 1 of 1

InstallEventHandler({OnMouseMove=p_Raton})

Posted: Wed Aug 22, 2018 3:26 pm
by Juan Carlos
I tryed to used this InstallEventHandler({OnMouseMove=p_Raton}) with this function to show/hide the mouse pointer with you play video and move the mouse, to hide or to show it, but the problem under Windows 7 64 bit it works, but under Windows 10 64 bit, MorphOS 3.11 and AmigaOS3.9 it doesn't work, the mouse pointer continues on the screen. Any idea of problem?

Function p_Raton()
;Hide mouse pointer.
If CursorRaton=1 And Video=1
HidePointer()
CursorRaton=0
EndIf
;Show mouse pointer.
If CursorRaton=0
ShowPointer()
CursorRaton=1
EndIf
EndFunction

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Wed Aug 22, 2018 5:44 pm
by jPV
This can't work, because:

Function p_Raton()
;Hide mouse pointer.
If CursorRaton=1 And Video=1
HidePointer() ; <--- Mouser pointer gets hidden
CursorRaton=0 ; <--- CursorRaton gets 0
EndIf
;Show mouse pointer.
If CursorRaton=0 ; <--- CursorRaton was set to 0 in the previous IF, so this is also executed
ShowPointer() ; <--- Pointer is shown again so it never actually gets hidden. Or is hidden just an eye blink.
CursorRaton=1
EndIf
EndFunction


Maybe this would do what you wanted? Add the video check for the latter if too.

Function p_Raton()
If CursorRaton=1 And Video=1
HidePointer()
CursorRaton=0
ElseIf CursorRaton=0 And Video=0
ShowPointer()
CursorRaton=1
EndIf
EndFunction

; Have this when you start the program and you have pointer visible:
CursorRaton=1


But maybe you should put HidePointer() and ShowPointer() somewhere where you start/stop the video playback, and not check these all the time when you move the mouse?

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Thu Aug 23, 2018 12:29 pm
by Juan Carlos
I tryed to used the ISVideoPlaying, but neither the function worked fine, the problem is that function works only under Windows 7.

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Fri Aug 24, 2018 5:57 pm
by jPV
In any case your original function can't work, it never hides the mouse pointer. If it does on Windows7, it's a bug :)

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Sun Aug 26, 2018 1:03 pm
by Juan Carlos
It isn't the first time that some instructions work in one system and in others not, someones work under Windows and under MorphOS or AmigaOS work of different way.

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Sun Aug 26, 2018 5:07 pm
by jPV
Well, it's more problematic if something should work and it doesn't work on some systems, but with your code this clearly shouldn't work, so not much harm done if it in some miraculous way works under Win7 :P Just fix your own code.

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Mon Aug 27, 2018 1:15 pm
by Juan Carlos
Some idea to better the code?

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Tue Aug 28, 2018 1:44 pm
by SamuraiCrow
@Juan Carlos
See the second post in this thread. jPV suggested changing the EndIf and the second If to an ElseIf command.

Re: InstallEventHandler({OnMouseMove=p_Raton})

Posted: Thu Aug 30, 2018 8:59 pm
by Juan Carlos
Thank all for your help, yes I put elseif and the code now works perfectly under all Amiga systems, I work in three proyects and sometimes I didn't see this failures.