Lets you create the following types of .NET forms in an ABL session (that co-exist with traditional ABL windows and dialog boxes):
![]()
A non-modal Multiple-Document Interface (MDI) parent form, which is not supported by the traditional ABL GUI.
PUBLIC Form ( )System.Windows.Forms.Form class (from the .NET Framework)Public
Properties
Public
MethodsPublic
EventsThe 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.
![]()
![]()
The form is displayed using either the .NET Show( ) method or the Application:Run( ) method invoked from a WAIT-FOR statement.
![]()
A Multiple-Document Interface (MDI) parent form, which is the foundation for an MDI application, has the following characteristics:
![]()
![]()
The form has one or more associated child forms that provide for user interaction with the application. Child forms can be minimized, maximized, and resized within the MDI container.
Note: To associate a child form with a parent form, use the Progress.Windows.Form class to create a child form and set the child’s .NET MDIParent property to the parent form.
![]()
When a parent form is closed, the Closing events of all child forms are raised before the parent form's Closing event is raised.
![]()
To display a modal form, you must invoke the WAIT-FOR statement with the form’s input-blocking ShowDialog( ) method, which does the following:
![]()
Prepares and displays the specified form in a wait (blocking) state until the .NET form is closed by either the user or the application.
Note: Unlike in a .NET application, invoking the ShowDialog( ) method in an ABL session does not, by itself, cause modal forms to display. Instead, you must invoke the WAIT-FOR statement to display these forms. For more information, see the WAIT-FOR statement (.NET objects) reference entry in this book.For information on the .NET ShowDialog( ) method inherited from the System.Windows.Forms.Form class, refer to the .NET Framework class library.
![]()
To display a non-modal form, you must invoke the WAIT-FOR statement with the input-blocking Application:Run( ) method, which does the following:
![]()
![]()
Displays the specified form in a wait (blocking) state until the form is closed by either the user or the applicationThis statement will also display any additional non-modal forms that you have previously prepared by setting their Visible property to TRUE and invoking their .NET Show( ) method. After the specified form is closed, any additional non-modal forms currently displayed are also closed and execution resumes.If you do not specify a form, the WAIT-FOR statement displays and blocks for input on any non-modal forms that have been previously prepared by setting their Visible property to TRUE and invoking their .NET Show( ) method. In this case, all non-modal forms currently displayed can be closed and execution can resume only after the application invokes the Application:Exit( ) method.
Note: Unlike in a .NET application, invoking the Show( ) method in an ABL session does not, by itself, cause non-modal forms to display. Instead, you must invoke the WAIT-FOR statement to display these forms. For more information, see the WAIT-FOR statement (.NET objects) reference entry in this book.For information on the .NET Show( ) and Application:Run( ) methods inherited from the System.Windows.Forms.Form class, refer to the .NET Framework class library.
![]()
To handle a .NET form event while the WAIT-FOR statement is blocking execution, you must write and subscribe an event handler to the specified event prior to invoking the WAIT-FOR statement. For more information on event handlers for .NET events, see the “Class Events Reference” section.
![]()
In most cases, it is best to create a delegate class that encapsulates the form definition and related methods. For information on using delegate classes for forms, see OpenEdge Development: GUI for .NET Programming.
![]()
For information on the public class members inherited from the System.Windows.Forms.Form class, refer to the .NET Framework class library.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |