I have an application that launches in a second monitor that extends from the primary display in full screen. I have this application running on 12 HMI’s perfectly fine, however when it runs on a normal Desktop PC it tries to put the application in a third, non-available monitor.
Ignition seems to treat HMI’s as laptops with a built in display. Could this be the root cause of the issue? After about 10 times of minimizing then maximizing the application it then displays it in the correct monitor.
Here’s the script to making it start up on the second monitor.
[code]from javax.swing import SwingUtilities,JFrame
from java.awt import Rectangle, GraphicsEnvironment, GraphicsDevice
ge = GraphicsEnvironment.getLocalGraphicsEnvironment()
data = 
for gd in ge.getScreenDevices(): #gets info of each monitor
gb = gd.getDefaultConfiguration().getBounds() #gets cordinate screen starts at and the width/height of screen
data.append([gb.x,gb.y,gb.width,gb.height]) #stores screen info in a list ([screen1], [screen2]
frame = SwingUtilities.getAncestorOfClass(JFrame, event.source)
frame.setBounds(data, data, data, data) #sets the area of the application to that of screens 2 bounds
frame.dispose() #closes the window from view in order to remove the border of the frame - can’t do it while frame is visible
frame.setUndecorated(True) #removes the border
frame.setVisible(True)#makes the frame visible again
#removal of the MenuBar is done in the application configuration[/code]