How do I Make an Ignition appication get the focus?

Ok, to do this from a tag-change script is a little stranger, because you don’t have a very straight-forward hook into the windowing system. The following works, but relies on at least one window being open. This is a fairly good assumption, because a Vision client with no windows open is pretty useless.

[code]from java.awt import Window
from javax.swing import SwingUtilities

allWindows = system.gui.getOpenedWindows()

if len(allWindows)>0:
topWindow = SwingUtilities.getAncestorOfClass(Window, allWindows[0])
topWindow.toFront()[/code]