Page 1 of 1

Any way to check what InstallEventHandler func is active and which display is active?

Posted: Tue May 20, 2025 1:54 pm
by Bugala
I am trying to bug hunt a bug that is related to having several Displays open at same time, and when I keep clicking on them, something strange is happening.

What I am currently thinking is if there would be a way to do two things.

1. To see which display is active. I could use interval function which would constantly keep printing which display is the active one.

2. When using InstallEventHandler({OnMouseUp = Function() EndFunction)}, is there any way to see which Function is currently installed?

As in, I could for example make all the functions print a line telling they are "func1", "func2" etc. but is there a way to for example manually execute what ever is installed to InstallEventHandler({OnMouseUp}) as example.

Point being that what I do know about the bug so far, is that it happens when I keep changing from one display to another, and strangely it seems like one InstallEventHandler({OnMouseUp}) stays erroneously on, even I cant see how that is possible, since I am using OnMouseUp=0 elsewhere on the code in such way that I cant see how it could still be on.

For this reason I would like to keep checking live if OnMouseUp is having what Function to execute, as well as seeing which display is activated, since I am thinking it might be executing one of the OnMouseUps somehow to one of the wrong displays.

Re: Any way to check what InstallEventHandler func is active and which display is active?

Posted: Tue May 20, 2025 3:01 pm
by plouf
GetAttribute() provides enought info

GetAttribute(#DISPLAY, 0, #ATTRACTIVE) can tell you if active also
GetAttribute(#DISPLAY, 0,#ATTRTITLE) can tell you title if you have name them...

also
GetAttribute(#EVENTHANDLER,"OnKeyDown",#ATTRFUNCTION) will return 0 if there is not installed/activated

Re: Any way to check what InstallEventHandler func is active and which display is active?

Posted: Tue May 20, 2025 3:31 pm
by Bugala
Thanks!
Didnt come to my mind that I can go through all the displays to find out which one is active.

These might help me find the problem.

Re: Any way to check what InstallEventHandler func is active and which display is active?

Posted: Fri May 23, 2025 12:09 pm
by Bugala
That was a difficult bug to hunt, not because the bug was so bad, but because it was based upon my own misunderstanding.

I thought that Window becoming Active window would be the same as using SelectDisplay, but thinking better, of course it can't be the same thing, otherwise I couldnt have two windows where one is active, and non-active is being updated with gfx.

The problem was that I used the OnMouseDown event to create EventHandler({OnMouseUp=}) and SetInterval, and thought it would be installed to the display/window that I just clicked to become active, but it was instead installing it to some other window.