attribute-buffer | pic x(n). |
PPB-Buffer-Offset | pic 9(4) comp-x. |
PPB-Panel-ID | pic 9(4) comp-x. |
PPB-Rectangle-Offset | pic 9(4) comp-x. |
PPB-Update-Count | pic 9(4) comp-x. |
PPB-Update-Height | pic 9(4) comp-x. |
PPB-Update-Mask | pic x. |
PPB-Update-Start-Col | pic 9(4) comp-x. |
PPB-Update-Start-Row | pic 9(4) comp-x. |
PPB-Update-Width | pic 9(4) comp-x. |
PPB-Vertical-Stride | pic 9(4) comp-x. |
text-buffer | pic x(n). |
attribute-buffer | If bit 1 of PPB-Update-Mask is set, specifies the buffer to hold the attributes read from the panel. |
PPB-Buffer-Offset | Where the first character read from the update rectangle is placed in the text buffer. |
PPB-Panel-ID | The identifying handle of the panel to read from. |
PPB-Rectangle-Offset | The number of characters not to read from the update rectangle. |
PPB-Update-Count | The number of characters to read from the update rectangle. |
PPB-Update-Height | The height of the update rectangle to read from. |
PPB-Update-Mask | If bit 0 is set, the text read from the panel is to be included in a text buffer. If bit 1 is set, the attributes read from the panel are to be included in an attribute buffer. |
PPB-Update-Start-Col | The first column of the specified panel to read from. |
PPB-Update-Start-Row | The first row of the specified panel to read from. |
PPB-Update-Width | The width of the update rectangle to read from. |
PPB-Vertical-Stride | The width of a line in the text buffer. |
text-buffer | If bit 0 of PPB-Update-Mask is set, specifies the buffer to hold the text read from the panel. |
This example assumes a panel has been defined that is 10 characters wide and 30 rows deep. The handle for this panel is saved in ws-save-panel-id.
This example reads a portion of this panel, starting from the first column of the 7th line, to the end of the panel. Text only (not attributes) is read into a buffer called text-buffer which is assumed to be defined in the Working-Storage Section of the program.
* Define an update rectangle to read from. In this case, * define the rectangle from line 7 through line 30 of the * panel. This is a total of 24 lines and each line is 10 * characters wide. move 10 to ppb-update-width. move 24 to ppb-update-height. * Start reading beginning with the 7th line and first column * of the panel. (0,0 is the top left-hand corner of the * panel.) move 6 to ppb-update-start-row. move 0 to ppb-update-start col. * Within the rectangle, read beginning with the first * character (where 0 is the top left-hand corner of the * rectangle). move 0 to ppb-rectangle-offset. * Read 240 characters into the buffers (24 lines times 10 * characters per line). move 240 to ppb-update-count. * Read updates beginning with the first character of the * buffer. move 1 to ppb-buffer-offset. * One row of the update rectangle is 10 characters wide. move 10 to ppb-vertical-stride. * Read text only, not attributes (set bit 0 of * PPB-Update-Mask). move x"01" to ppb-update-mask. * The panel identifier was saved in ws-save-panel-id. move ws-save-panel-id to ppb-panel-id. * Read text from the panel into text-buffer, defined * as PIC X(240). move pf-read-panel to ppb-function. call "PANELS" using panels-parameter-block text-buffer. if ppb-status not = zero * (code to abort)
Comments:
PF-Read-Panel does not behave like an ACCEPT statement; that is, it does not allow the user to input information to a panel. If you want to obtain information from the user, you must use an ACCEPT statement.
You must make sure that the buffers are large enough to accommodate the data that Panels places into them. If they are not large enough, Panels could overwrite information following the buffers in the Working-Storage Section of your program.