Forms, Controls, and Menus
In Windows-based applications, dialog boxes prompt the user for data needed by the application to continue or to display information to the user. Dialog boxes are a specialized type of form object that can be created in one of three ways:
Predefined dialog boxes can be created from code using the ALERT instruction.
Customized dialog boxes can be created using a standard form or by customizing an existing dialog box.
Standard dialog boxes, such as Print and File Open, can be created using the OPEN, PREPARE, and SPLOPEN instructions.
The code for displaying an ALERT dialog box in PL/B looks like this:
You supply three pieces of information, or arguments, to the ALERT instruction: a values that determines the style of the dialog box, the message text, and a result variable. Optionally a fourth parameter can specify the alert box title. Styles are available with various combinations of buttons and icons to make creating dialog boxes easy.
Because most dialog boxes require user interaction, they are usually displayed as modal dialog boxes. A modal dialog box must be closed (hidden or unloaded) before you can continue working with the rest of the application. For example, a dialog box is modal if it requires you to click OK or Cancel before you can switch to another form or dialog box.
Modeless dialog boxes let you shift the focus between the dialog box and another form without having to close the dialog box. You can continue to work elsewhere in the current application while the dialog box is displayed. Modeless dialog boxes are rare; you will usually display a dialog because a response is needed before the application can continue.
![]() |