Consultor Eletrônico



Kbase P153501: How to launch .NET Applications from ABL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/15/2009
Status: Unverified

GOAL:

How to launch .NET Applications from ABL


GOAL:

What is the .NET I/O Blocking Model?

GOAL:

Is it possible to use more than one WAIT-FOR in .NET Applications?


FACT(s) (Environment):

OpenEdge 10.2A
Windows

FIX:

It is strongly recommended that only one WAIT-FOR is specified in your application. This has always been recommended, to avoid multiple input-blocking statements, including multiple WAIT-FOR
statements.
For 10.2A, if you have a WAIT-FOR on a .NET form, i.e. Application:Run, then it is not allowed to start another WAIT-FOR on a non-modal .NET form. If this case occurs the WAIT-FOR raises the STOP condition.
Although this is the only case that is explicitly not allowed, it does not mean that the other cases are recommended. The biggest danger in this area is that the input-blocking statements will terminate out of sequence. If this happens then the results in the application are unpredictable.
A non .NET WAIT-FOR cannot be used once a .NET form is visible. The exception to this is a OpenEdge dialog box.

The .NET I/O Blocking Model can be used in :
Application with a single main formWAIT-FOR Application:Run( form ) Other forms are children of the main form Closing the main form automatically terminates WAIT-FOR Application with several equal forms WAIT-FOR Application:Run( ) Forms shown at the same time or separately An event handler needs to terminate WAIT-FOR using call to Application: Exit( )

There are three ways of displaying a form:

1.- When a main form is specified, one way to display it is to specify the name of the form as part of a WAIT-FOR statement. The form name myForm is specified as a parameter to the RUN method in the class Application. When the WAIT-FOR statement with Application:Run(myForm) is executed an instance of myForm is created and displayed. Once there is an active WAIT-FOR you can display additional forms by using the Show method. The Show method is available in the
Progress.Windows.Form class.
To have a single controlling form for the WAIT-FOR, the form is added as a parameter to Application:Run(). Application is a .NET object (System.Windows.Forms.Application) and Run is a method on that object.
To exit the wait-for condition of a form specified in the Run method do one of the following:

Close the main form using the X button on the form window Close programmatically using the Close method on the instance of the form Close programmatically using the Exit method on the Application object instance (System.Windows.Forms.Application:Exit().)
All open forms close when the Application:Run method ends.

2.- An alternative to specifying a main form on the Run method is to call the Show method prior to being in an I/O blocked state (calling a WAIT-FOR statement). If the application is not in an I/O block state then the form is not displayed when the Show method is called. It is however ready to be displayed. For example, if you have two forms and you called the Show method on both of them then they will both be displayed as soon as an I/O blocking statement takes place.
An alternative to the Show method is setting the visible property to TRUE.
If a form is not specified in the Run method then there isn't a main form specified, so the WAIT-FOR must be satisfied by a the defined exit condition. In this case to get out of the WAIT-FOR, the Exit() method must be called at some point closed to avoid leaving the application in a hung state.

3.- The last option would be to use a Modal Dialog box: the WAIT-FOR is on a dialog box. You would need to call ShowDialog to display and start WAIT-FOR (WAIT-FOR myDlgForm:ShowDialog([parent form])).
To exit the wait-for condition do one of the following:
Close the form by clicking on the X button Close the form programmatically (myDlgForm: Close ())