PreviousNextIndex

Progress.Windows.Form class


(Windows only; GUI for .NET only)

Lets you create the following types of .NET forms in an ABL session (that co-exist with traditional ABL windows and dialog boxes):

Constructors

PUBLIC Form( ) 

Super Class

System.Windows.Forms.Form class (from the .NET Framework)

Interfaces

Progress.Windows.IForm interface

Public
Properties

Public
Methods


This class does not contain methods (beyond those it inherits from its base class).

Public
Events


This class does not contain events (beyond those it inherits from its base class).

Example

The following example shows a simple ABL class that inherits from Progress.Windows.Form create a non-modal form with two buttons that looks behaves like a dialog box, except that it is non-modal:

USING System.Windows.Forms.* FROM ASSEMBLY. 
CLASS DemoForm INHERITS Progress.Windows.Form: 
  /* Variables for buttons on the form */ 
  DEFINE PRIVATE VARIABLE OkBtn     AS Button. 
  DEFINE PRIVATE VARIABLE CancelBtn AS Button. 
  CONSTRUCTOR DemoForm ( ): 
    InitializeComponent( ). 
  END CONSTRUCTOR. 
   
  /* Event handlers for buttons on the form */ 
  METHOD PUBLIC VOID okButton_Click  
    ( sender AS System.Object, e AS System.EventArgs ): 
    THIS-OBJECT:DialogResult = DialogResult:Ok. 
    THIS-OBJECT:Close ( ). 
  END METHOD. 
  METHOD PRIVATE VOID cancelButton_Click  
    ( sender AS System.Object, e AS System.EventArgs ): 
    THIS-OBJECT:DialogResult = DialogResult:Cancel. 
    THIS-OBJECT:Close ( ). 
  END METHOD. 
  /* Display and wait for this non-modal form to close.  
     The caller blocks at a call to this method         */ 
  METHOD PUBLIC VOID Wait ( ): 
    WAIT-FOR Application:Run ( THIS-OBJECT ). 
  END METHOD. 
  METHOD PRIVATE VOID InitializeComponent ( ): 
    /* Instantiate button classes */ 
    OkBtn     = NEW Button ( ). 
    CancelBtn = NEW Button ( ). 
    /* Initialize the form and buttons */ 
    THIS-OBJECT:Text       = "<form title>". 
    OkBtn:Text             = "OK". 
    CancelBtn:Text         = "Cancel". 
    OkBtn:DialogResult     = DialogResult:OK. 
    CancelBtn:DialogResult = DialogResult:Cancel. 
    /* Set the size and location of the form and buttons */ 
    THIS-OBJECT:Size   = NEW System.Drawing.Size( 300, 300 ). 
    OkBtn:Size         = NEW System.Drawing.Size( 75, 23 ). 
    OkBtn:Location     = NEW System.Drawing.Point( 121, 231 ). 
    OkBtn:Anchor       = CAST( Progress.Util.EnumHelper:Or 
      (AnchorStyles:Bottom, 
       AnchorStyles:Right ), 
       AnchorStyles). 
    CancelBtn:Size     = NEW System.Drawing.Size( 75, 23 ). 
    CancelBtn:Location = NEW System.Drawing.Point( 205, 231 ). 
    CancelBtn:Anchor   = CAST( Progress.Util.EnumHelper:Or 
      (AnchorStyles:Bottom, 
       AnchorStyles:Right ), 
       AnchorStyles ). 
    /* Subscribe to events */ 
    OkBtn:Click:Subscribe( okButton_Click ). 
    CancelBtn:Click:Subscribe( cancelButton_Click ). 
    /* Add buttons to the form */ 
    THIS-OBJECT:Controls:Add( OkBtn ). 
    THIS-OBJECT:Controls:Add( CancelBtn ). 
  END METHOD. 
END CLASS. 

To instantiate DemoForm and display the non-modal form, you can run a procedure that contains the following code:

DEFINE VARIABLE DisplayFormDemo AS CLASS DemoForm. 
DisplayFormDemo = NEW DemoForm( ). 
DisplayFormDemo:Wait( ). 

For more examples, see the chapter on creating and using forms and controls in OpenEdge Development: GUI for .NET Programming.

Notes
See also

Progress.Util.ResourceHelper class, WAIT-FOR statement (.NET and ABL)


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex