Using map_get_inputs() helps ensure your programs' dialogs work with a consistent user interface. It also reduces the amount of clutter in your code.
Before discussing map_get_inputs() it will help if you understand more about how dialogs work in DP4:
In DP4 programs validation of entry fields is usually performed as soon as the user moves away from the field in a forward direction. We think it is less annoying for users to do validation like this rather than validating all the fields at the end, (so that the user does not find out about mistakes until they think they hoped they had finished), as is common with other ADEs that manage dialogs.
A dialog always processes all its fields in order.Programs can rely on fields entered earlier in the dialog being correct. If a user uses the mouse or a cursor key to move away from the current field in a forward direction, missing out several intervening fields, your program will still get a chance to validate all the intervening fields. Occasionally it may mean the user does not end up where he expects, but usually he will, and the logic of your program is much simpler than it would be if you had to write a separate validation routine.
Internally DP4 manipulates variables like jump, input_field, and (possibly) clearfirst, and remembers the history of the dialog. For example uses the cursor end key to move to the last field on a row, it might turn out that the last field was disabled, in which case DP4 will set the field number to point to the previous field on the row. On the other hand if the user then tabs forward from that field, hitting the disabled last field again, DP4 will then decide to move to the first field on the next row. How DP4 determines the field a cursor key should move to is explained in Cursor Movement in Maps and how navigation proceeds round the fields of a map is explained in detail in Field Navigation During Data Entry. You don't need to fully understand the latter. A good principle to remember is that to you the programmer, it will usually look as though the user is moving round the dialog in a sensible way, but to the user it will look as though he can, within reason, move round the dialog in any way he chooses.
map_get_inputs() is usually responsible for displaying the map a dialog will use, initialising various global variables ready for the dialog and then calls your callback function to process each field in turn.
Your callback function may be used in two distinct phases:
An initial (optional) predisplay phase displays the initial values for each field in the dialog map.
A second "real" pass through the fields is used to collect input from the user.
When the user completes or cancels the dialog map_get_inputs() will return, after performing various (optional) cleaning up operations, such as clearing the dialog map and restoring global variables.
An example of using map_get_inputs() together with pick_record() can be found next.