GUI ScreenIO for Windows

 ScreenIO.com


Programming Overview

In the normal GUI ScreenIO programming model, you don't worry about working-sets.  You simply call GUI ScreenIO to display a panel and wait for GUI ScreenIO to return to your program.  When it does, you evaluate the event that caused it to return, and then either update and redisplay the same panel, display a different panel, or close the main panel and STOP RUN.  It is not possible for the user to switch to a different panel because all of them except the current panel are disabled; Windows won't let the user operate on any panel except the current one (the last one you displayed).

A multiple working-set application is similar, but with a twist; because one panel in each working-set is enabled, it's possible for the user to activate a panel other than the last one that you displayed.

Let's consider this a bit further.  Suppose that your application opens a main window and then displays base panel A (base panels are always working-set 1).  Next, you display panel B in working-set 2. 

Now, consider what happens when the user clicks on panel A.  The user expects to activate panel A and modify its data, but your program is waiting for an event from panel B, the last one that it displayed!

If you think about this, you'll see this can't be handled the same as it is in a single working-set application, because your program is waiting for an event (and data) from panel B (the last one you displayed), but the user wants to work with panel A, which was displayed earlier.  Obviously, your program needs to abandon panel B (for the time being) and activate panel A so it can accept events and data from panel A.

GUI ScreenIO handles this in a simple way; it returns from panel B and tells you that the user wants to activate panel A.  All your program needs to do is to call GUI ScreenIO and redisplay (activate) panel A.  Now your program is waiting for an event (and data) from panel A. 

If the user clicks on panel B, GUI ScreenIO returns from panel A and tells you the user wants to activate panel B.  So, you just call GUI ScreenIO and redisplay (activate) panel B. 

That's all there is to it.

Programming Considerations

There are two obvious differences between a single and a multiple working-set application. 

First, when the user clicks on an inactive window in a different working-set, your program must activate that window by calling GUI ScreenIO and passing the panel's copybook, just as you'd normally do when you wish to display that panel.

Second, you must explicitly close the first panel of a working-set when the user wants to close that set.

Other than these two items, there are no special considerations for handling a multiple working-set application - but the program flow control to handle switching between sets can become complex very quickly if you don't design it carefully. 

The sample program we provide contains a very simple and general-purpose set-switching method.

Requests to close your application

One subtle difference in a multiple working-set application is that the user can click the X box in the title bar of the main container any time the main is enabled.  This will return a panel-EVENT-CLOSE-AND-STOP, which is a request to close the application.  This could be received at an inconvenient or unexpected point in your application, but you should still honor it if possible.

Your application should, therefore, be coded so that it is capable of closing files and terminating from everywhere in the application (unless you can't allow it, in which case you should warn the user).

The sample application handles this by setting the 88-level item END-OF-JOB to TRUE, which causes control to return to the main program, which then would close files and STOP RUN.

Assigning working-set numbers

Base panels are always assigned to working-set 1; you cannot modify the working-set of a base panel.

You may assign any number between 2 and 9999 to new working-sets.  It is not necessary to assign them in any particular order; the working-set number is just an identifier. 

Maximum number of active working-sets

GUI ScreenIO will, theoretically, support a maximum of 200 working-sets at any one time.  We have tested the panel editor with 50, which is more than any rational application should require!

Opening a new working-set

You open a new working-set by moving the set number to panel-WORKING-SET and then displaying the panel as usual. 

Interactions between panels in the same working-set

If this is the first panel displayed in a working-set, it will leave all of your other panels in their current state; that is, it won't disable panels in any other working-sets.

If this panel is not the first one displayed in a working-set, it will disable the previously active panel in the same working-set so that only the last panel displayed in any working-set, is enabled.  This prevents the user from activating any panel in the working set other than the last panel displayed in that set.

Closing panels

GUI ScreenIO manages the panels of each working-set just as it does in a conventional, single working-set application. That is, you don't need to (and should NOT) manually close panels when you're finished with them.  GUI ScreenIO determines when a panel needs to be closed and will handle it automatically.

When you redisplay a panel in a given working-set, it will automatically close all panels in that working-set, that were displayed following it. 

That is, if you display panels A, B, and C in working-set 2, and then redisplay panel A, GUI ScreenIO will automatically close panels B and C.  This is consistent with simple GUI ScreenIO applications.

Switching between working-sets

When a user wants to activate a panel in a working-set other than the currently active (and last-displayed) panel, he/she will click on the desired panel. 

In response, GUI ScreenIO returns a panel-EVENT-INACTIVATED to your program, and tells you the name and working-set of the panel that is going to become active in the fields panel-ACTIVATED-PANEL-NAME and panel-ACTIVATED-WORKING-SET.

Your response is to simply call GUI ScreenIO to display the panel that's becoming active.

Closing a working-set

To close a working-set, you set panel-DO-CLOSE to TRUE and call GUI ScreenIO to close the first panel in the working-set.

GUI ScreenIO will automatically close the other panels of the working-set.

Again, you only need to explicitly close the FIRST panel of a working-set when you wish to close that working-set.

Events

Clicking the X box in the main will return a panel-EVENT-CLOSE-AND-STOP to your application, while clicking the X box in a popup returns a panel-EVENT-CLOSE-WINDOW.  These events, of course, have different meanings; the first is a request to close your application, while the second is just a request to close the popup.

Simplifying programming:

GUI ScreenIO, by default, makes panels "working-set modal" which means that only the last panel displayed in a working-set is active. You're already used to this, even if you didn't know the Windows terminology.

In your multiple working-set application, you will probably want to prevent the user from switching away from the currently active panel before you get too many levels deep. To do this, make the panel "modal" in the panel editor (Panel Properties/Runtime Behavior/Modal). A modal panel disables all of the other panels in your application, which prevents the user from switching away from it.

There are many cases where you want the user to finish a task before you'd let them switch to another working-set. This is easy to enforce by making the panel that handles that task, modal.

Once you display a modal panel, the user will be restricted to the active panel, even if subsequent panels are "modeless" (the modal switch wasn't set), because the panels in the other working-sets won't be re-enabled until you're finished with the modal panel. The sample application shows how this works.

Things to avoid

Otherwise, your application just needs to ensure that it passes control to the panel that the user wants to activate. This is fairly straightforward, particularly if you use modal panels strategically.

You cannot have the same panel active in two different working-sets, unless its panel copybook resides in two different subroutines; that is, two copies of the same panel cannot share the same data.

It's possible to display a series of panels from ANY working-set, provided you make the first panel in the series modal, thereby preventing the user from displaying this series a second time. The sample application does this with subroutine SETX, which can be called from almost anywhere in the application. It's a potentially useful technique.


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom