Creating a Paged Autoload Control

Much of the code for paged controls is generated into the Event Paragraph and made available for direct editing. This code is created once, then left untouched to preserve any modifications that you might make. Because you can customize the code directly, rather than going through a graphical interface, the list in the bottom, right portion of the Autoload window is very simple for paged controls. It contains the only two options that affect the portion of the autoload code generated into the write-protected .prd file.

The initial steps used to create paged autoload controls are similar to the steps used to create unpaged controls, with the following differences:

  1. Open the Drag-and-Drop window and click Paged Grid or Paged List-Box as the control type.
  2. In the Autoload window, you can modify the Start Key selection or add an Invalid Key Perform Paragraph.

    The other options listed for unpaged controls do not appear.

  3. When you are finished, click OK. AcuBench draws the control on the screen form and immediately adds code to the Event Paragraph to control how data is loaded into the control. When you generate your program, a very small amount of additional code is generated in the .prd COPY file to manage some portions of the autoload process for the paged control. The code in the .prd file should not be modified directly.

The code added to the Event Paragraph when the control is drawn on the screen is appended to whatever event code you have already created. To allow you to make free use of this autoload code, AcuBench does not modify or regenerate the code once it has been created. This means that any changes that you make will be preserved when the program is generated. Because AcuBench does not retain control of this code once it has been added to the Event Paragraph, if you delete the control with which the code is associated, you must manually delete the code.

Note that code added to the Event Paragraph for your use is not deleted if you delete the paged control from the screen form. Like event code that you create, the AcuBench-created autoload code must be manually deleted from the Event Paragraph when it is no longer being used.

As a corollary to this, Working-Storage items associated with a paged autoload control must also be manually deleted. Because you are free to make changes to these variables to support modifications to the code in the Event Paragraph, AcuBench does not retain control over these variables and will not delete them.

CAUTION:
If you delete a paged autoload control, but do not delete the associated code in the Event Paragraph, you will receive compiler errors. Also, you must delete any Working-Storage items associated with the deleted control before creating another paged autoload control with the same name. If you do not, undefined behavior is likely to result.