Running a ABL form without the wait-for

Posted by PeterWokke on 16-Sep-2014 06:14

Basically you start the first ABL form of your application with  wait-for application:Run(,ABlForm.cls.).

The first screen should be started like that.

How to open all kind of other forms you need to open within your application?

Regards, 

Peter Wokke

All Replies

Posted by Matt Gilarde on 16-Sep-2014 06:24

Once the WAIT-FOR is running you just need to use the Show method on any other forms you want to display. Use the ShowDialog method for dialog boxes.

Posted by PeterWokke on 18-Sep-2014 03:01

Hi Matt,

Thank you for this replay.

define variable clsMenuStructure as menu.MenuStructure no-undo.

clsMenuStructure = new menu.MenuStructure().

clsMenuStructure:Show().

When I test the form from the AppBuilder

The form is shown. But events are not triggered.

When I start it with a wait-for like this.

wait-for System.Windows.Forms.Application:run(clsMenuStructure).

The form is shown and the events like ultraTreeMenu_AfterSelect work as supposed.

Could this be the solution:

&IF DEFINED(UIB_IS_RUNNING) = 0 &THEN

wait-for System.Windows.Forms.Application:run(clsMenuStructure).

&ELSE

clsMenuStructure:Show().

&ENDIF

Regards,

Peter

Posted by Lieven De Foor on 18-Sep-2014 04:12

You only need the WAIT-FOR for the main form of the application (closing that form terminates the WAIT-FOR).

All other forms can simply be shown using MyForm:Show() or MyForm:ShowDialog().

Posted by Peter Judge on 18-Sep-2014 07:57

Peter,

I think you going to want to do something like the below.

/* this internal proc or method will typically launch
   and :Show() a  form (login-window, whatever)
*/
run InitializeApplication.

/* note no form passed in. once this wait-for runs, the screens show and the user can interact with the app. */
wait-for System.Windows.Forms.Application:Run().


/* once you're done ... kill wait-for so that the application doesn't hang. This should be called from the closing of a (the last) form. */
System.Windows.Forms.Application:Exit().

There's also the OpenEdge GUI for .NET Task Map that has a section on using WaIT-FOR's

-- peter

Posted by tbergman on 18-Sep-2014 09:21

It's possible I'm missing something here but I believe the OP is referring to difficulties when running programs from the AppBuilder/PDS. If not, then here's my problem.

When testing a form using AppBuilder, either in PDS or separately, the .w gets run persistently by adecomm/_runprog.p. _runprog.p contains its own WAIT-FOR and it's a conventional GUI WAIT-FOR, not the .NET style.

This makes it very difficult to test a .w from within the AppBuilder/PDS because if the .w then opens a .Net form, errors will occur.

I could certainly customize _runprog.p but I shouldn't have to.

Posted by tbergman on 18-Sep-2014 09:25

Correction - "When testing a form " should read "When testing a window"

Posted by Peter Judge on 18-Sep-2014 10:57

There are a couple of bugs open and in development that look to address this  issue (PSC00250364 for _runprog.p and PSC00257927  for PDSOE's _server.p).

Add your name to them via Tech Support if you want to get notification on when they're fixed.

-- peter

This thread is closed