Get Ignition client window size

I’m looking to get the full size of the client window (i.e. the desktop size), not just the individual windows that make up the client display.
E.g. I want to get the combined size of all docked window(s) and the floating windows.

I’m not sure how to get an object reference to the desktop to do this… from what I can tell, if I can get a reference to the VisionDesktop object, then I can use the getSize method to get its size.

How can I do this?

Import javax.swing.SwingUtilities and use getRoot on some component on the window:

from javax.swing import SwingUtilities
root = SwingUtilities.getRoot(<reference to some component>)
1 Like

The oldies, but goodies...

1 Like

Thanks Paul. Next challenge: what if I don’t have any windows open at the time? E.g. on client startup, with no windows set to launch on startup? I want to be able to launch a different header dock window based on if the client is on a PC (high res) or an HMI (low res, typically 1366x768). This would be in the Client startup script

Simple solution: Make a 1x1px ‘null’ window, and in the client startup script, open that, use getRoot from that reference, then close it right after.

Thanks too Jordon, this actually resolves my other issue as well :slight_smile:

1 Like