Feedback
Did this article resolve your question/issue?

   

Article

Throwing the Progress.Lang.AppError pops up in the message area at the bottom of the Progress window instead of the alert box

Information

 
TitleThrowing the Progress.Lang.AppError pops up in the message area at the bottom of the Progress window instead of the alert box
URL Name000072507
Article Number000152009
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: All supported platforms
Question/Problem Description
when throwing and error as follows:
UNDO, THROW NEW Progress.Lang.AppError (ErrorMessage, MessageNumber).
error message is displayed in the message area at the bottom of the Progress window (this is not the case when running from Progress Developer Studio for OpenEdge, the error message pops up in alert box).

For an example please refer to the below Steps to Reproduce. 
Steps to Reproduce1. Download example.zip attached at the bottom of the page.
2. Compile the code.
3. Run "prowin -p RunForm1.r" from proenv.
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
If the current window (the one which the CURRENT-WINDOW system handle is set to) has a message area, messages will be displayed in the current window's message area by default. If the current window doesn't have a message area, messages will be displayed in alert boxes by default. SESSION:APPL-ALERT-BOXES changes this behaviour so that messages are always displayed in alert boxes regardless of whether the current window has a message area. However SESSION:APPL-ALERT-BOXES applies to the MESSAGE statement only. If it is required that messages generated by the AVM (error messages, warnings, etc.) are always to be displayed in alert boxes it is necessary to also set SESSION:SYSTEM-ALERT-BOXES = TRUE. 

If the code doesn't create a window or it creates a window but it doesn't set CURRENT-WINDOW to the window, CURRENT-WINDOW will refer to the AVM's default window. The default window has a message area so in that case the messages appear in the message area instead of in alert boxes unless SESSION:APPL-ALERT-BOXES and SESSION:SYSTEM-ALERT-BOXES is set to TRUE.

If the window is designed in the AppBuilder (either standalone or in PDSOE) the window won't have a message area by default and the code sets CURRENT-WINDOW to the window's handle, as shown below, so messages will be displayed in alert boxes. 
ASSIGN CURRENT-WINDOW = {&WINDOW-NAME}
    THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
Note: Above does not apply only for Progress.Lang.AppError. All errors are treated the same in this respect.
Resolution
Set session SYSTEM-ALERT-BOXES and APPL-ALERT-BOXES parameters to TRUE as follows:
SESSION:SYSTEM-ALERT-BOXES = TRUE. 
SESSION:APPL-ALERT-BOXES = TRUE.

In the attached example uncomment the commented session parameters set to true in the runForm1.p and recompile the code.
Workaround
Notes
Last Modified Date8/4/2016 9:40 AM
Attachment 
Files 1. example.zip
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.