Managing Group Layers - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

The following clauses affect group layers. Group properties are set like layer properties as part of the optional group layer clause in the Set Map statement.

Syntax 1 (Group)

Set Map 
	[ Window window_id ] 
	[ GroupLayer group_id [ Display { On | Off } ] 
		[ Title "new_ friendly_name" ] ]

Syntax 2 (Ungroup)

Set Map 
	[ Window window_id ] 
	[ GroupLayer group_id  [ Ungroup [ All ] ] ]

window_id is the integer window identifier of a Map window.

group_id can be either the numeric ID or a string name. The name would refer to the first group found in the list with that name.

Description

Ungroup removes the group layer but insert all the children of the group list into the parent list. All keyword will ungroup all nested group layers and insert all children into the parent list. Draw order will be maintained.

Examples

GroupLayer "Tropics" (group 1)

Tropic_Of_Capricorn (layer 1)

Tropic_Of_Cancer (layer 2)

Wgrid15 (layer 3)

GroupLayer "World Places" (group 2)

WorldPlaces (layer 4)

WorldPlacesMajor (layer 5)

WorldPlaces_Capitals (layer 6)

Airports (layer 7)

Set Map GroupLayer 1 Ungroup results in this list (with group and layer ID's renumbered):

Tropic_Of_Capricorn (layer 1)

Tropic_Of_Cancer (layer 2)

Wgrid15 (layer 3)

GroupLayer "World Places" (group 2)

WorldPlaces (layer 4)

WorldPlacesMajor (layer 5)

WorldPlaces_Capitals (layer 6)

Airports (layer 7)

whereas

Set Map GroupLayer 1 Ungroup All results in this list:

Tropic_Of_Capricorn (layer 1)
Tropic_Of_Cancer (layer 2)
Wgrid15 (layer 3)
WorldPlaces (layer 4)
WorldPlacesMajor (layer 5)
WorldPlaces_Capitals (layer 6)
Airports (layer 7)

Title will rename to the group layer to the string contained in grouplayer_id_string. The following renames group layer 2 in the Layer Control layer list as Hello World:

Set Map GroupLayer 2 Title "Hello World"