.NET to ABL Syntax

Posted by Roger Blanchard on 22-Aug-2012 10:12

How would the following be converted to ABL?

Screen monitor2 = System.Windows.Forms.Screen.AllScreens[1];

I have tried the following.

DEFINE VARIABLE oMonitor AS System.Windows.Forms.Screen NO-UNDO.

oMonitor2 = System.Windows.Forms.Screen:AllScreens[1].

I get the error "AllScreens is NOT an ABL array or indexed property, therefore using a subscript is not valid (13809)

All Replies

Posted by Peter Judge on 22-Aug-2012 10:27

Try:

DEFINE VARIABLE oMonitor AS System.Windows.Forms.Screen NO-UNDO.

oMonitor = cast(System.Windows.Forms.Screen:AllScreens:GetValue(0),System.Windows.Forms.Screen).

-- peter

Posted by robw@hltool.com on 22-Aug-2012 10:57

Nice - and

oMonitor = cast(System.Windows.Forms.Screen:AllScreens:GetValue(1),System.Windows.Forms.Screen).

gives you details on screen 2 settings.

GetValue(2) throws an index error. So one can cycle through possible screen and check for errors.

It would be interesting to scale one's framework based on these settings. I'm an IT guy and have users that have 'old people' settings of 800 x 600, even on 22" inch screens.

Posted by Roger Blanchard on 22-Aug-2012 11:01

Peter,

Works like a charm.

Thanks.

Posted by Roger Blanchard on 22-Aug-2012 11:02

You can also use System.Windows.Forms.SystemInformation:MonitorCount to get the number of monitors.

This thread is closed