field_skip()

Purpose

Moves to the next field

Old name

#define omit(mapnr,fieldnr) field_skip(mapnr,fieldnr,0)
#define skip_field field_skip

Syntax

void field_skip(mapnr, DP4P fieldnr, direction)

Parameters

int mapnr

Number of map containing field

 

int DP4P fieldnr

Pointer to variable holding current field

 

int direction

Direction in which to move to next field

 

The parameter direction can take one of these values:

 

Value

Meaning

 

0

Moves in the "current" direction. The current direction will depend on how the user last left and field, and whether there have been any other calls to field_skip() since. Internally this function may wait for input, for example if the current field number corresponds to a button.

 

1

Acts as if the user had terminated normally

 

2

Acts as if the user had pressed the <Tab> key

 

LEFT

Acts as if the user presses the <←> key

 

RIGHT

Acts as if the user presses the <→> key

 

DOWN

Acts as if the user presses the <↓> key

 

UP

Acts as if the user presses the <↑> key

 

You can also use other direction values such as LEFT_LINE,RIGHT_LINE,BACKTAB, and SPACE_BAR

 

NULL_INT

If the fieldnr exists in the map, it is not changed. If it is invalid, it is set to the nearest valid field number. If the global variable range is not 0, the nearest valid field number less than or equal to the parameter fieldnr is taken. NULL_INT is used to ensure that fieldnr is valid in functions like field_choose(). To improve the behaviour of programs that do not have the MENUMAP flag specified on a map that is to be used as a menu, the map properties are changed as if the map were displayed with the MENUMAP flag and not with DATAMAP or REMARK. This value is only intended for use by field_choose() and similar functions.

Description

The field_skip() function is used in application programs which use scrnx_map() functions to avoid stopping for input in a given field. It increments or decrements the field number as required to move to the next field. The next field depends on how the parameter direction is set.

Return values

The return value is abort_code. This allows field_skip() to perform input if the field being omitted is a button field.

See also

inpm_omit(), field_skip()

Remarks

Calling this function with a non zero direction should be regarded as exceptional. About the only good reason for doing this is when you have just called an input function using one map, but want to set the next field number in another map as though the key used to terminate the input belonged to a field in that map. For example the BROWSER utility uses the following scheme for doing input in some situations (this code is schematic only):

void input_inner(int m,int *f)
{
  int fieldnr = 1;
  map_attach(m,*f,INPUT_MAP,DATAMAP|HIDDEN);
  scrn_map(INPUT_MAP,&f,get_data(*f),get_data_type(*f),get_data_size(*f),DEFAULT);
  map_glue(m,
  field_skip(m,*f,abort_code);  
}

To the user it will appear as though input is taking place directly in the underlying map, and if he uses a cursor to leave the field the behaviour will be what he expects. The code shown here would not work properly if the user tried to move to another field with the mouse.