Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Detect if Visualization is in Focus

2020-06-11
2020-06-15
  • jackcaissey - 2020-06-11

    Hello all.

    We are looking for a way to determine whether or not each visualization is in focus or not. If for example a web visualization is not in focus (i.e. minimized) we want the program to terminate. Are there any built in methods for tracking visualization focus? or alternatively, would it be easier to write a script in another language to track if a visualization is in focus, then relay the information back to the codesys program? Other alternate solutions would be welcome as well.

    Please let me know if there are any additional solutions.

     
  • m.prestel - 2020-06-15

    Hello @jackcaissey,

    do you know if there are any javascript APIS available which allow the detection?
    If the browser doesn't tell the website it lost the focus, not much the webvisu can do?

    @dgirard are you having the same use case?

    Best regards
    Marcel

     
  • jackcaissey - 2020-06-15

    I know there are several Javascript methods which will return a boolean based on whether or not the tab is in focus. However, I am unsure about how to call this javascript method for each instance of the visualization.

     
  • m.prestel - 2020-06-15

    e.g?

     
  • jackcaissey - 2020-06-15

    for example the hasFocus() method

     
  • jackcaissey - 2020-06-15

    You're right, I thought this was a method which could be used with a window. Another idea we had however was to have a signal which only triggers when a user is viewing a given visualization. If the user changes visualization, the signal stops, and another program can be executed to stop the program.

     
  • m.prestel - 2020-06-15

    As far as I understand it the other thread is more focused on a watchdog feature for buttons.

    I think it differs from your request to detect if a tab is invisible.

    Best regards,
    Marcel

     

Log in to post a comment.