map_attach()

Purpose

Attaches one map to another map

Old name

#define attach_map map_attach

Syntax

void map_attach(mapnr, fieldnr, newmap, flags)

Parameters

int mapnr

The number of the map to which the new map is to be attached

 

int fieldnr

The field number to attach the new map

 

int newmap

The number of the map to be attached

 

int flags

Parameter specifying colour and other attributes

 

Permissible values for the parameter flags are:

 

Value

Meaning

 

DEFAULT

Take flags and default colours from the owning map. Use either this flag or a combination of the others

 

DATAMAP

Use if map is a data entry map. (DEFAULT works incorrectly if attached to a MENU)

 

RETAIN

The map stays until cleared by one of the map clearing functions. If the map is already on the screen attached to the same point the existing map is cleared

 

REMARK

Clears the map following the next input or next display of a free map which is not a remark map

 

ERRORMAP

Displays the map as an error map

 

MENUMAP

Sets cursor wrap on and displays the map in menu colours

 

HIDDEN

Initially displays the map as a hidden map. On its own this flag does not prevent the parent maps proprties from being inherited. You can use this flag if the attached map will be "glued".

 

IN_BOX

Displays the map in a box

 

NO_SCROLL_OFF

This retains any of the maps currently on the screen

 

MPA_FREE

This flag positions the map as an attached map, then allows it to become a free map. (It has the same value as CLEAR which is not implemented for map_attach().) This makes it easier to build up complex screens with a mixture of free and attached maps, because:

  • The map to which the map was attached can be cleared or hidden without the new map being cleared
  • The new map is avoided by subsequent free maps. But, you may encounter problems unless you draw other maps with NO_SCROLL_OFF

 

MPA_ON_TOP

When this flag is specified, the map is always kept on top of its attached map, no matter how the terminal manager rearranges the screen. You cannot use this flag with MPA_FREE. This is an alternative to the use of the map_glue() function, provided for the case when the attached map must be kept alive. If MPA_ON_TOP is not specified, it is possible for the underlying map to be put on top of maps to which it is attached. This flag is not implemented in version 4.6xx.

Description

This function attaches a map to an existing map on the screen. The program terminates if either the map given by the mapnr parameter is not on the screen, or the map to attach to does not exist.

The attached map is placed at the top of the viewing order.

Example

/*
C Functions Reference Manual
----------------------------
Filename: MAP_ATTA.C
Example: map_attach
Purpose: Program uses map_attach to illustrate
fixed positioning of error maps.
*/

/*
#db salesord
#c
#end
*/
#include "dp4.h"
#include "map_atta.h"
/* generate this file by running LIBMAKE */
/* prototypes */
void error_mess(int);
void process()
{
/* put up layout map - use hidden so it doesn't
affect the position of subsequent map calls */
map_draw(1,RETAIN | HIDDEN);
map_datamap(2); /* header comment map */
/* put up sample error message */
error_mess(3);
}

void error_mess(int map_nr)
/* display error message at a fixed position,
ie, the position of field 1 in layout map */
{
attach_map(1,1,map_nr,ERRORMAP);
askf_special(map_nr,1,0);
map_clear_from(map_nr);
}