Tutorial Chapter 13: Master/Detail using Multiple Dialogs
This chapter shows how to implement order and items input in a
unique DIALOG
statement. In chapter 11 the order input is detached from the items
input. The code example in chapter 13 makes both order and item input fields active at the same
time, which is more natural in GUI applications.
The Master-Detail sample The Customer List Form The Customer List form displays when the user clicks the button next to the store number field (the buttonEdit widget). The custlist.per form defines a typical 'zoom' form with a filter field and record list where the user can pick an element to be used in a field of the main form. Using this form, the user can scroll through the list to pick a store, or can enter query criteria to filter the list prior to picking. The fields that make up the columns of the table that display the list are defined as FORMONLY
fields. When TYPE
is not defined, the default data type for FORMONLY
fields is CHAR
.The Customer List Module The custlist.4gl module defines a 'zoom' module, to let the user select a customer from a list. The module could be reused for any application that requires the user to select a customer from a list.The Orders Form The form specification file orderform.per defines a form for the orders
program, and displays fields containing the values of a single order from the orders
table. The name of the store is retrieved from the customer
table, using the column store_num
, and displayed.The Orders Program orders.4gl The orders.4gl module implements the main form controller. Most of the functionality has been described in previous chapters. In this section we will only focus on the DIALOG
instruction programming. The program implements a DIALOG
instruction, including an INPUT BY NAME
sub-dialog for the order fields input, and an INPUT ARRAY
sub-dialog for the items input. Unlike traditional 4GL programs using singular dialogs, you typically start the program in the multiple dialog instruction, eliminating the global MENU
instruction.