Embedding a .Net Form inside an ABL window

Posted by Admin on 23-Oct-2009 14:47

I'm dipping my toes in the .Net UI pool and I'm struggling with a basic problem.  How does one get a .Net Form to act like an ABL frame so that it embeds in an ABL window?  All the examples show the other way around, a .w inside a Form.  From what I read, this should be possible.

Thanks to this forum, I figured out that you replace the ABL WAIT-FOR with a the .Net version.  Below is the main block from a standard window generated from the AppBuilder.  The testform is a basic .Net Form created in the visual designer.

I found the ProWinHandle:Parent syntax in the Progress .Net UI PDF documentation.  It dosn't make a difference here.

What happens when this runs is that the Form is a separate window on top of the ABL window.  Is there a attribute on the Form that makes it act like a frame, or am I completely off base here?

Thanks in advance.

DEFINE VARIABLE frm AS testform NO-UNDO.
...

MAIN-BLOCK:
DO ON ERROR   UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
   ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
  RUN enable_UI.
  frm = NEW testform().
  frm:ProWinHandle:parent = CURRENT-WINDOW .
  frm:Show().
WAIT-FOR System.Windows.Forms.Application:Run(  ). 
/*  IF NOT THIS-PROCEDURE:PERSISTENT THEN*/
/*    WAIT-FOR CLOSE OF THIS-PROCEDURE.  */
END.

All Replies

Posted by Peter Judge on 23-Oct-2009 15:11

Is there a attribute on the Form that makes it act like a

frame, or am I completely off base here?

You'd need to look at something like the Progress.Windows.UserControl (since there's not really an equivalent to a frame); however, since the ProWinHandle only applies to the P.W.Form class you're out o' luck on that front.

It might be worth your while chatting to tech support or logging an enhancement request for this.

-- peter

Posted by Admin on 23-Oct-2009 15:37

I'm dipping my toes in the .Net UI pool and I'm struggling with a basic problem.  How does one get a .Net Form to act like an ABL frame so that it embeds in an ABL window?  All the examples show the other way around, a .w inside a Form.  From what I read, this should be possible.

You need to embed the Window widget in a .NET Form (you should prefer the Progress.Windows.WindowsContainer control over the Progress.Windows.MdiChildForm). Then you may add any .NET Control to the same form and actually overlay the embedded ABL window.

The biggest challenge is to synchronize the focus. But that's certainly doable.

Posted by jquerijero on 23-Oct-2009 15:54

If I read your requirement correctly about trying to the embed an ABL Form inside a Legacy .w, you can set the parent of the .NET form using the Win32 API SetParent. Pass it the HWND of the frame.

People who have tried this had a hit-or-miss success, specially TAB key, LEAVE and ENTRY events are problematic.

Posted by Admin on 23-Oct-2009 16:01

You can set the parent of the .NET form using the Win32 API SetParent. Pass it the HWND of the frame.

Works even well - but leaves you with the same focus issue.

This thread is closed