Modal Forms

The Form class showModal method blocks execution of code until the form is unloaded, so actions cannot be replayed on a modal form.

To handle this, a handleShowModal method is generated in the profile class. It calls the Form class show method rather than the Form class showModal method. Profile methods can then be replayed as normal. At the end of the handleShowModal method, the value that was captured at recording time is returned.

To support this, you must reimplement the Form class showModal method to call the handleShowModal method. If the application has reimplemented this in its common superclass, you can change that reimplementation.

There is a sample showModal method in the Erewhon version of AtcgGeneratorSchema, in the FormBase superclass. There is also a sample test profile with a modal form provided by the ModalDemo.cls file. It uses the Edit Company form in the Administration application. For details about running AtcgTestCodeSchema with multiple applications, see "Multiple Applications Support", later in this chapter.

Nested modal forms are supported.

There are several parsing tokens specifically for modal forms. It is necessary to strictly separate the code that is generated for action on the modal form versus that for the other forms; for example, a single reference to the modal form after it is closed generates an exception.