Can ABL window remain active when a .NET form is called?

Posted by nix1016 on 21-Aug-2015 01:46

I'm displaying the crystal reports viewer on a .NET form using something like

def var FormObjectRef  as class Progress.Windows.Form NO-UNDO.
def var crystalReportViewer1  as CrystalDecisions.Windows.Forms.CrystalReportViewer  NO-UNDO.

FormObjectRef = NEW Progress.Windows.Form().
crystalReportViewer1 = NEW CrystalDecisions.Windows.Forms.CrystalReportViewer().

crystalReportViewer1:ReportSource = crwReport.

FormObjectRef:Controls:Add(crystalReportViewer1).

WAIT-FOR FormObjectRef:ShowDialog().

The issue is that whilst the .NET form is open I can't actually use my ABL program in the background even when it is minimised, it's similar to a dialog box. Is there anyway that I can resume activity on my ABL window without having to close the crystal viewer? 

All Replies

Posted by Mike Fechner on 21-Aug-2015 01:49

ShowDialog starts the Form modal - so blocks all other windows.

Try to use Show().

You may however have to use a

WAIT-FOR System.Windows.Forms.Application:Run().

as the first WAIT-FOR Statement if you haven't.

Posted by nix1016 on 22-Oct-2015 00:48

Thanks Mike.

I tried using Show() instead of ShowDialog() and I'm getting the error "You can only use a .NET-specific input-blocking statement (WAIT-FOR x:y()) once any .NET forms are shown (other than to wait for an ABL dialog box). (13967)".

When should I be calling WAIT-FOR System.Windows.Forms.Application:Run()? When I call it just before the WAIT-FOR FormObjectRef:Show() statement, it simply just freezes before it loads the report viewer. Looking at Progress KB knowledgebase.progress.com/.../P12116, it mentions that there should only ever be one WAIT-FOR call at a time unless if I'm mistaken? Thanks!

Posted by Mike Fechner on 22-Oct-2015 01:11

You can certainly allow simultanious into to both windows.

But the very first (and hopefully only wait-for - exception are modal Dialogs) in your session needs to be:

WAIT-FOR System.Windows.Forms.Application:Run().

If you are currently using an classic ABL WAIT-FOR like

WAIT-FOR CLOSE OF THIS-PROCEDURE .

or similar, you will Need to change your startup procedure. To bypass that WAIT-FOR, you need to call

System.Windows.Forms.Application:Exit().

There must be dozens of threads on this forum with more code samples.

Posted by Mike Fechner on 22-Oct-2015 01:11

You can certainly allow simultanious into to both windows.

But the very first (and hopefully only wait-for - exception are modal Dialogs) in your session needs to be:

WAIT-FOR System.Windows.Forms.Application:Run().

If you are currently using an classic ABL WAIT-FOR like

WAIT-FOR CLOSE OF THIS-PROCEDURE .

or similar, you will Need to change your startup procedure. To bypass that WAIT-FOR, you need to call

System.Windows.Forms.Application:Exit().

There must be dozens of threads on this forum with more code samples.

Posted by Lieven De Foor on 22-Oct-2015 04:25

You shouldn't write WAIT-FOR with the Show() method!

It's either

WAIT-FOR MyForm:ShowDialog().

or

MyForm:Show(). /* No WAIT-FOR */

Which makes sense as you want the code to continue after showing the form.

And like Mike said, the first WAIT-FOR statement in you application should be a WAIT-FOR System.Windows.Forms.Application:Run().

Posted by nix1016 on 22-Oct-2015 18:33

Ah I was using WAIT-FOR with the show() method which was causing the errors.

I've changed it now to:

   FormObjectRef:Show().

   WAIT-FOR System.Windows.Forms.Application:Run(FormObjectRef).

But I'm still having the same issue with the ABL window being inactive whilst the Form is open. The first WAIT-FOR in my application is System.Windows.Forms.Application. Anything else I might be missing?

Posted by Laura Stern on 22-Oct-2015 18:50

First, you don't need to call show on the window that you pass into Application:Run(), though it doesn't hurt to do that.  .Net will automatically call Show() on it for you.

Second, it's not clear to me how you are displaying the ABL window.  You should have the Application:Run at the start as Mike said.  Then you would just view the ABL window without any WAIT-FOR.  It will become visible and active along with any other non-modal window or form, under the existing WAIT-FOR.  Only calling WAIT-FOR frm:ShowDialog() or a WAIT-FOR on an ABL window with VIEW-AS DIALOG-BOX that should block access to those non-modal forms/Windows.

Lastly, if you had passed a form into Application:Run, you don't need to call Application:Exit. You just need to close that main form.  Alternatively, you can also call Application:Run with no parameter, e.g. if the app dynamically decides which form to open first (which you would then  just call Show() on).  In that case you need to call Application:Exit to end the application.

Posted by jquerijero on 03-Nov-2015 12:52

Is there a reason why you are running WAIT-FOR System.Windows.Forms.Application:Run()? Is FormObjectRef your main form (entry program)?

Posted by Laura Stern on 03-Nov-2015 12:56

As was stated above, if you want to show any .NET forms, non-modally, your main WAIT-FOR (and hopefully the only one except for dialogs) needs to be "WAIT-FOR System.Windows.Forms.Application:Run()"

This thread is closed