Personal Computer News


Simpler Editing On The QL

 
Published in Personal Computer News #091

Simpler Editing On The QL

These procedures for the QL are designed to be incorporated in a program to simplify the editing of a large number of variables. A full screen display of prompts and variable values is used to help you.

Procedure init: All variables should be initially declared. Dummy$ is used for exiting from the procedures and this is achieved by entering x in dummy$.

Procedure screen: Displays instructions at the bottom of the screen.

Procedure get vars: This will consist of a list of variables with the appropriate parameters to be passed to var$. Line 280 shows that numeric as well as string variables can be used. However, a non-numeric input will crash the program, so it is better to use a string variable which you should validate before assigning to the numeric variable.

Parameter pr-inp is a flag to indicate if input is required (pr inp=1). First time around this is 0 (line 120) so all the prompts and current variable values are displayed, without waiting for an input.

Pr-inp is then set to 1 (line 300) and the procedure calls itself (line 310). It will now step through each variable waiting for an input. The last is dummy$ and until X is entered, the program continues to loop around. Note - the use of == is equivalent to IF dummy$="X" or IF dummy$="x" as it ignores cases.

Function vars$: Parameters are screen, line and row coordinates. Prompt$, :'s are inserted at each end of the space allowed for the variable. Var is the current value of the variable and var is the maximum length of the variable.

Line 410 allows Enter to be pressed to accept the displayed value.

Peter Edwards
Headington Quarry, Oxon

Peter Edwards