# Multi-Line Control

Format and Validation Logic |

NOMADS allows you to specify a sub-program to be called for the purpose of data validation and/or formatting whenever there is input in a Multi-Line.

## Formatter

NOMADS can CALL a sub-program to convert the data from internal format to the format used in the display of a Multi-Line.

To associate formatter logic with a Multi-Line control, enter the name of a formatter sub-program (no quotes) with an optional entry point label into the Formatter property of the Multi-Line control (on the Validation tab of the Multi-Line Properties dialogue). The Panel Header Default Program is automatically assumed if a label name (;label) is used omitting the program name.

Click the Program Logic button beside the Formatter property to launch the default program editor, which is typically the *IT - Integrated Toolkit. To make Ed+ the default program editor, change the setting for the %NOMADS'Program_Editor property to Ed+.

(The ability to set Ed+ as the default program editor was added in PxPlus 2023.)

At run time, *winproc will CALL formatter logic using the following syntax:

> CALL "subprog[;label]",data_value$, tag_field$

Where:

data_value$ | NOMADS passes the internal value of the input to the sub-program in the CALL. The sub-program converts it for display.
tag_field$ | User-defined tag field value (if any). NOMADS picks this up from your setting in the Formatter property of the Multi-Line control and passes it to the sub-program in the CALL

Equivalent parameters should be used (a maximum of two valid variable names) in the called program.

## Validator

NOMADS can CALL a sub-program to validate Multi-Line input. To associate validator logic with a Multi-Line control, enter the name of a validator sub-program (no quotes) with an optional entry point label into the Validator property of the Multi-Line control (on the Validation tab of the Multi-Line Properties dialogue). The Panel Header Default Program is automatically assumed if a label name (;label) is used omitting the program name.

Click the Program Logic button beside the Validator property to launch the default program editor, which is typically the *IT - Integrated Toolkit. To make Ed+ the default program editor, change the setting for the %NOMADS'Program_Editor property to Ed+.

(The ability to set Ed+ as the default program editor was added in PxPlus 2023.)

At run time, *winproc will CALL the validator logic using the following format:

> CALL "subprog[;entrypoint]",input$,err_msg$,tag_field$,old_value$,input_eom$

Where:

input$ | Input that the user entered is automatically passed to this variable.
err_msg$ | Error message to display. By default, this returns a null to the calling program.
tag_field$ | User-defined tag field value (if any). NOMADS picks this up from your setting in the Validator property of the Multi-Line control and passes it to the sub-program in the CALL.
old_value$ | Old value for the field, passed to your sub-program in the call.
input_eom$ | Hex value of the terminator used to end input. Terminator examples include $0D$ for Enter or $09$ for Tab to leave a Multi-Line.

Equivalent parameters should be used (a maximum of five valid variable names) in the called program. If the input is found to be invalid by your program, load the second variable with error message text. Once the exit is executed in your sub-program, control returns to *winproc, which checks this variable. If it contains a value other than null, a message box is displayed using the text assigned by your program and focus returns to the Multi-Line input field for a retry. The user cannot exit that control until valid input is entered.