The following demonstrates the typical function sequence:
- Load the DCL file with a load_dialog call.
- Call new_dialog to
display a particular dialog box.
Be sure to check the value returned by new_dialog. Calling start_dialog when the new_dialog call has failed can have unpredictable results.
- Initialize the dialog box by setting up tile values, lists, and images. Initialize also when you call action_tile to set up action expressions or callback functions. Other functions typically called at this time are set_tile and mode_tile for general tile values and states, start_list, add_list, and end_list for list boxes, and the dimension functions with start_image, vector_image, fill_image, slide_image, and end_image for images. At this time you can also call client_data_tile to associate application-specific data with the dialog box and its components.
- Call start_dialog to turn control over to the dialog box, so that the user can enter input.
- Process user input
from within your actions (callbacks). Process input when you are
most likely to use get_tile, get_attr, set_tile,
and mode_tile.
The user presses an exit button, causing an action to call done_dialog, which causes start_dialog to return a value. At this point, unload the DCL file by calling unload_dialog.
This scheme handles only one dialog box and one DCL file at a time. Applications usually have multiple dialog boxes. The easiest and quickest way to handle these dialog boxes is to save all of them in a single DCL file. The load_dialog call then loads all dialog boxes at once, and you can call new_dialog for any dialog box. If memory is limited, however, you may need to create multiple DCL files and use unload_dialog to remove one set of dialog boxes from memory before you load another set.