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

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

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

Post 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.
plouf
Posts: 666
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

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

Post 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
Christos
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

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

Post 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.
Bugala
Posts: 1390
Joined: Sun Feb 14, 2010 7:11 pm

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

Post 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.
Post Reply