Screen resolution of extended display

Questions, tips and tricks and techniques for scripting in Servoy

Screen resolution of extended display

Postby ylockson » Wed Jun 19, 2013 8:06 am

application.getScreenHeight() & application.getScreenWidth() return the resolution of the primary display.

In a two-monitor setup, is there a trick to programmatically determine:
1. the resolution (screen width & height) of the extended display?
2. if an extended display is connected?
ylockson
 
Posts: 59
Joined: Thu Mar 01, 2012 8:40 am

Re: Screen resolution of extended display

Postby Andrei Costescu » Thu Jul 11, 2013 10:46 am

(all this is for SmartClient only) In case the system uses virtual coordinates, the following code will print to console the virtual values for screen bounds - and it should also work with moving/auto restoring saved bounds for windows on other screens in Servoy. (some configuration bounds will not start at 0, 0 in this case - when using multiple screens)

Code: Select all
var ge = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
var gs = ge.getScreenDevices();
var j;
for (j = 0; j < gs.length; j++) {
     var gd = gs[j];
     application.output("Default configuration with bounds: " + gd.getDefaultConfiguration().getBounds() + " found for screen '" + gd.getIDstring() + "'.");

     // OR, if you want to see all capabilities of a screen
     //var gc = gd.getConfigurations();
     //var i;
     //for (i=0; i < gc.length; i++) {
     //    application.output("Configuration with bounds: " + gc[i].getBounds() + " found for device '" + gd.getIDstring() + "'.");
     //}
}
I guess a plugin would be useful in this area.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: Screen resolution of extended display

Postby ylockson » Fri Jul 12, 2013 4:16 pm

Thanks a million Andrei. I had given hope that there was a way...
ylockson
 
Posts: 59
Joined: Thu Mar 01, 2012 8:40 am


Return to Methods

Who is online

Users browsing this forum: No registered users and 3 guests