Progress KB - How to embed an ABL window in a .NET form?




Feedback
Did this article resolve your question/issue?

   

Article

How to embed an ABL window in a .NET form?

« Go Back

Information

 
TitleHow to embed an ABL window in a .NET form?
URL NameP145112
Article Number000150547
EnvironmentProduct: OpenEdge
Version: 10.2x, 11.x
OS: Windows
Other: .NET UI
Question/Problem Description
How to embed an ABL window in a .NET form?
Is is possible to have an ABL window embedded in a .NET form?
Steps to Reproduce
Clarifying Information
Error MessageThe window may not be embedded because it has already been realized. (14837)
Defect/Enhancement Number
Cause
Resolution
In order to embed an ABL window (.W) in a .NET form, changes must be made to the AppBuilder-generated code in order to prevent it from enabling. The .W must be enabled/visualized via the Progress.Windows.WindowContainer control. If the .W has not been configured correctly then error 14837 will occur when running the ABL Form.

Perform the following steps:

ABL Window (.W)
1) In the "Runtime Attributes and AppBuilder Settings" section, change "C-Win:HIDDEN = no." to "C-Win:HIDDEN = yes.". For example:
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(C-Win)
THEN C-Win:HIDDEN = YES.

2) In the Main Block, comment out the following statement:
RUN enable_UI.


ABL .NET Form (.CLS)

1)  Add the following 'USING' statement at the top of the file:
USING Progress.Windows.*.

2)  Add a Progress.Windows.WindowContainer to the .NET form and define the handles as PRIVATE:
DEFINE PRIVATE VARIABLE h AS HANDLE NO-UNDO.
DEFINE PRIVATE VARIABLE hWin AS HANDLE NO-UNDO.
DEFINE PRIVATE VARIABLE WinContainer1 AS Progress.Windows.WindowContainer NO-UNDO.  


3)  In the constructor method, after the InitializeComponent() method add:

WinContainer1 = NEW Progress.Windows.WindowContainer( ).

RUN <ABL_WINDOW>.w PERSISTENT SET h.
hWin = h:CURRENT-WINDOW.

WinContainer1:EmbeddedWindow = hWin.

/* Resize windowContainer1 to size of ABL Window */
/* WinContainer1:Size = NEW System.Drawing.Size( hWin:WIDTH-PIXELS, hWin:HEIGHT-PIXELS ).*/
       
/* Resize windowContainer1 to size of Form */
WinContainer1:Size = NEW System.Drawing.Size( THIS-OBJECT:WIDTH, THIS-OBJECT:HEIGHT ).
       
/* Reposition windowContainer1 to top-left corner */
WinContainer1:Location = NEW System.Drawing.Point(0,0).
       
WinContainer1:PARENT = THIS-OBJECT.
WinContainer1:Show().

RUN enable_UI IN h.

4)  Add the following code to the destructor method:
IF VALID-HANDLE(h) THEN DO:
     DELETE OBJECT h.
END.
Workaround
Notes
References to Other Documentation:
 
OpenEdge Development: GUI for .NET Programming
OpenEdge Development: ADM and SmartObjects
OpenEdge Development: ADM Reference

Progress Information Hub, Use .NET forms with ABL Windows, Embed ABL Windows in .NET forms:
https://docs.progress.com/bundle/use-gui-for-net/page/Embed-ABL-windows-in-.NET-forms.html
 
Progress Article(s):
Last Modified Date11/20/2019 7:23 PM
Attachment 
Files
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.