.NET to ABL Syntax - Forum - OpenEdge Development - Progress Community
 Forum

.NET to ABL Syntax

  • 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)

  • 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

  • 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.

  • Peter,

    Works like a charm.

    Thanks.

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