ShowPointer() without mouse activity

Discuss any general programming issues here
Post Reply
Flinx
Posts: 192
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

ShowPointer() without mouse activity

Post by Flinx »

The ShowPointer() function only works when a status change comes from the mouse buttons or there is a movement. This does not bother much, but maybe it can be improved. Here an event should display the pointer when the mouse button is pressed, but this only works if there is further mouse activity after the event.
My test script:

Code: Select all

EnableLayers()
TextOut(10,10,"Start",{Name="msg"})
For i=1 To 100
	Wait(2500,#MILLISECONDS)
	SetLayerStyle("msg", {Text="HidePointer"})
	HidePointer()
	Wait(2500,#MILLISECONDS)
	SetLayerStyle("msg", {Text="ShowPointer"})
	ShowPointer()
Next
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: ShowPointer() without mouse activity

Post by Bugala »

I can confrim this. Same happens with Windows 10 Hollywood 9.1.

Hidepointer works fine, but ShowPointer doesnt happen, unless I move my mouse or something.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ShowPointer() without mouse activity

Post by airsoftsoftwair »

Yes, I can confirm it too. Will be fixed.
Flinx
Posts: 192
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: ShowPointer() without mouse activity

Post by Flinx »

By the way, I remember that moving a layer under the mouse also did not trigger an OnMouseOver event if there was no mouse movement. Maybe this is the same effect?
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ShowPointer() without mouse activity

Post by airsoftsoftwair »

Have you got an MCVE for that?
Flinx
Posts: 192
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: ShowPointer() without mouse activity

Post by Flinx »

Sure. It was a Layer button. Move the pointer over the box, and then place it in the path of the box.

Code: Select all

EnableLayers()

Function p_blue()
	SetDisplayAttributes({Color=$003377})
EndFunction

Function p_black()
	SetDisplayAttributes({Color=#BLACK})
EndFunction

Function p_Main()
	xp=xp+1
	If xp>GetAttribute(#DISPLAY, 1, #ATTRWIDTH) Then xp=-50
	SetLayerStyle("box", {X=xp})
EndFunction

SetFillStyle(#FILLCOLOR)
xp=0
Box(xp, 100, 50, 50, #GRAY, {Name="box"})
MakeButton(1, #LAYERBUTTON, "box", {OnMouseOver=p_blue, OnMouseOut=p_black})
SetInterval(1, p_Main, 30)

Repeat
	WaitEvent
Forever
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ShowPointer() without mouse activity

Post by airsoftsoftwair »

Thanks, now I understand the issue but I'm not sure if I'm going to fix this because it can probably trigger lots of unwanted behaviour for scripts that expect the old behaviour. The first issue is clearly a bug, though.
Flinx
Posts: 192
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: ShowPointer() without mouse activity

Post by Flinx »

Maybe it makes sense to collect such things, and introduce a global switch for a compatibility mode at some point?
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ShowPointer() without mouse activity

Post by airsoftsoftwair »

Flinx wrote: Sun Sep 04, 2022 9:30 am Maybe it makes sense to collect such things, and introduce a global switch for a compatibility mode at some point?
Yes, introducing a compatibility mode would be the only way to fix this.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: ShowPointer() without mouse activity

Post by airsoftsoftwair »

Code: Select all

- Fix [Windows]: ShowPointer() wasn't effective until a mouse event came in 
Post Reply