8.5 Using Multiple Pop-up Windows

Workstations connected to an IBM i use an "attribute byte" on the screen to control a field's attributes. Things controlled by this byte include reverse video, underlining, high intensity, etc.

If you write applications that make frequent use of pop-up windows, you should be aware of the concept of attribute bytes and the cosmetic problems that may result if you overlay one with a pop-up window.

For example, if the following window was displayed on a workstation screen panel:

                                                                       
                           ...........................                 
                           :                         :                 
                           :                         :                 
                           :                         :                 
                           :      WINDOW  ONE        :                 
                           :                         :                 
                           :                         :                 
                           :.........................:                 
                                                                       
                                                                       

 

 

And then you overlay another window like this:


                .....................                                  
                :                   :                                  
                :   WINDOW TWO      : ................                 
                :                   :                :                 
                :                   :                :                 
                :...................:                :                 
                           :      WINDOW  ONE        :                 
                           :                         :                 
                           :                         :                 
                           :.........................:                 
                                                                       

 

 

 

 

Then the actual resulting display will look like this:

 
                .....................                                  
                :                   :                                  
                :   WINDOW TWO      :                                  
                :                   :                :                 
                :                   :                :                 
                :...................:                :                 
                           :      WINDOW  ONE        :                 
                           :                         :                 
                           :                         :                 
                           :.........................:                 
                                                                       
 

 

 

 

The top border of window 1 has disappeared from the display, because window 2 erased its attribute byte from the screen panel.

While this does not cause any program or screen processing problems, it is usually considered to be aesthetically unacceptable.

However, this problem can be prevented if some simple site techniques for window handling are developed and then followed.

Review these three site techniques

Technique 1

Technique 2

Technique 3

Technique 1

Make sure that the windows do not overlap one another. They are either completely separate from one another, or completely replace one another.

While this technique is very effective, it is very boring and largely nullifies the aesthetic appeal of overlapping windows.

Technique 2

Another technique is to always use windows that only overlap each other on the left hand side. Additionally, no window overlaps the top or bottom border of a window on its right.

For example, a program might display windows 1, 2 and then 3. The final display might look like this:


                                        ............................   
                                        :                          :   
                        ............... :                          :   
                        :               :                          :   
             .......... :               :                          :   
             :          :      WINDOW   :       WINDOW THREE       :   
             :  WINDOW  :       TWO     :                          :   
             :    ONE   :               :                          :   
             :          :               :                          :   
             :......... :               :                          :   
                        :               :                          :   
                        :.............. :                          :   
                                        :                          :   
                                        :..........................:   

 

 

Note however, that any one of the 3 windows can be redisplayed without causing the top or bottom border or any existing window to disappear. For example, redisplaying window 2 would cause a display like this:


                                        ............................   
                                        :                          :   
                        ................................           :   
                        :                              :           :   
             .......... :                              :           :   
             :          :            WINDOW            :   WINDOW  :   
             :  WINDOW  :              TWO             :   THREE   :   
             :    ONE   :                              :           :   
             :          :                              :           :   
             :......... :                              :           :   
                        :                              :           :   
                        :..............................:           :   
                                        :                          :   
                                        :..........................:   
  

 

 

If window 1 was then redisplayed, the resulting display would look like this:

  
                                        ............................   
                                        :                          :   
                        ................................           :   
                        :                              :           :   
             ........................                  :           :   
             :                      :      WINDOW      :   WINDOW  :   
             :       WINDOW         :       TWO        :   THREE   :   
             :        ONE           :                  :           :   
             :                      :                  :           :   
             :......................:                  :           :   
                        :                              :           :   
                        :..............................:           :   
                                        :                          :   
                                        :..........................:   
  

 

 

Technique 3

This technique merely involves combining techniques 1 and 2 together with a "plan" of the windows and testing each window against some simple rules.

Consider the following example for 4 windows.  Any of the windows can be redisplayed at any time without upsetting any other window.

Note how every window, but one, conforms to the following rules.


            ..........................  ............................   
            :                        :  :  2                       :   
            :     1     ................................           :   
            :           :                              :           :   
            :  ...................                     :           :   
            :  :                 :       3             :           :   
            :  :                 :                     :           :   
            :  :                 :                     :           :   
            :  :       4         :                     :           :   
            :  :                 :                     :           :   
            :  :                 :                     :           :   
            :  :                 :                     :           :   
            :  :.................:                     :           :   
            :           :                              :           :   
            :           :..............................:           :   
            :                       :   :                          :   
            :.......................:   :..........................:   

 

 

Note that window 1 does not conform to these rules. It overlaps the top and bottom left hand corners of window 3, and therefore could cause the top and bottom border areas of window 3 to "disappear".