Unexpected event

Enclosed in a widow I have a checkbox. I only hide the window or show it. I was not expecting the unchecked box to fire it’s action event when the window is hidden. Is this normal and if so what might be a work around?

It should not happen… But in the action event you could check if the window is visible or active


I’ve never seen that happen. Try to replicate it in a very simple project.

1 Like

Have you tried to put a breakpoint in the Action event and looking at the stack? Does it show a queue?

Is it a desktop project? Which OS?

It does not seem to be normal.

That said, unless you change the value in code, there will always be a mouse event before the action event. So you could separate legitimate action events by adding a property such as MouseDownHappened as Boolean that you set true in the checkbox MouseDown.

Then in the Action event, you can have something like:

if not(MouseDownHappened) then return
MouseDownHappened = False
// Do whatever you need to do in checkbox Action

You can also do a subclass if you need that in several places.

Also inform your Xojo version and OS (including version).

Tim and others, you were right. The action event was being triggered from elsewhere. Looking through the stack as you mentioned, Arnaud helped me figure it out.