I have set a print Python handler in the events associated with operniong/closing or activating windows operations, but it seems these events are not fired because I don’t see any message in the console, only the message associuated with ActionPerformed (see the png attached)
I need to handle these events for initialising Python code (when Windows open) or cleanbing (when the window close)
I am on Ignition 7.6.7
in my post i wanted to say ‘propertyChange’ instead of ‘ActionPerformed’
So the only print I see is PropertyChange sometimes when the window close or open (not all time)
Are you testing this in the Designer? Doing this can leave windows open instead of closing them and confuse the situation. You are better to create 2 windows with buttons to swap from one to the other and test them in a client, looking at the console in the diagnostics window (open this with Help / Diagnostics or Ctrl+Shift-F7).
I put print statements in all the internalFrame and visionWindow events. When I first opened the window the following events fired:
internalFrameActivatedWhen I closed the window these events fired:
internalFrameClosedWhen I opened the window a second time these events fired:
internalFrameActivatedWhen I closed the window a second time these events fired:
internalFrameClosedThe only difference is that internalFrameOpened only fires the first time, maybe because the window is being cached.
All that said, if I wanted code to run when a window opened I would put it in visionWindowOpened. If I wanted it to run when a window closed I would put it in visionWindowClosed.
Be careful putting code in the propertyChange event. This runs a lot and you have to filter it by checking the name of the event before you run any code.
Thanks a lot I am going to test it on a vision Client on the gateway (effectively I have tested in the designer)
I am going to test if the cache polici property has an influence ( by switching never / always) to see if all events are fired when the window is cached
I have tested with and without cache and it works in the 2 cases if I run the projhect on the gateway and check with Help->Diagnostic>Console
Thanks for the help
I’d stick with the visionWindow Opened / Closed events, and don’t mess with the internal frame events if you can help it.
I second this. The Event Description for internalFrameActivated is a bit misleading regarding the focusing part.