We write all of our maintenance programs as DDS windows. While in an application, the user has the ability to call up a maintenance program window or several windows. The new DDS keyword allows you to dynamically control the position of the window on your screen, but the color is hardwired. A way around this is to code seven WDWBORDER keywords in your DDS, each conditioned by a different indicator and each with a separate color.
To give each window displayed a different border color, when the window program is called, pass it a one-byte decimal field initialized to zero. The window program receives this window color parameter, adds one to it, then sets the indicator for that particular color. On subsequent program calls, it passes the same parameter and adds one to get a different color. If the color exceeds seven (the limit), the program resets it to one. This gives each window a different color (you would not be able to hardwire the different colors in, since the programs could be called in any order).
Not only that, but you can dynamically position a window displayed by program X by passing a one-byte code to X instead of the actual coordinates. This simplifies coding and eliminates having to change the programs that call X should you change the size of the window. For example, you could use the table shown in 3. The numbers have been selected that way to match the positions of the keys in the numeric keypad of your display station.
Not only that, but you can dynamically position a window displayed by program X by passing a one-byte code to X instead of the actual coordinates. This simplifies coding and eliminates having to change the programs that call X should you change the size of the window. For example, you could use the table shown in Figure 3. The numbers have been selected that way to match the positions of the keys in the numeric keypad of your display station.
Using this approach, program X could position the window by setting values for the variables coded in the WINDOW DDS keyword for the display file. For instance, if WINDOW(&LIN &COL 6 20) is coded, program X could set LIN to 1 and COL to 2 when it receives 'UL', thereby positioning the window at line 1, column 2 (upper-left corner).
TechTalk: Color My World With Windows
Figure 3 Window positioning codes
Figure 3: Window Positioning Codes 7 = Upper-left corner 8 = Upper edge, centered 9 = Upper-right corner 4 = Left edge, centered 5 = Center of screen 6 = Right edge, centered 1 = Lower-left corner 2 = Lower edge, centered 3 = Lower-right corner
LATEST COMMENTS
MC Press Online