CreateLegendDlg() function - 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

Purpose

Launch the Create Legend dialog to create and insert a legend into an empty legend frame on the current page of a Layout Window. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

CreateLegendDlg(WINDOW source_win, int layout_frame_id);

WINDOW source_win - the WINDOW id of a map frame on the current page of the Layout, or the Layout WINDOW id.

int layout_frame_id - the 1-based index of an empty frame on the current page.

  • If the source_winis the WINDOW id of a map on the current page, Step 1 of the dialog is initialized to show the layers of the map that can be used to create legends. You are allowed to select one layer in Step 1.

  • If the source_winis the WINDOW id of the Layout itself, Step 1 of the dialog is initialized to show a combo box of all the map frames on the current page that can create legends (if there are more than one). You are allowed to select any map from the combo, and then to select one layer in Step 1.

Return Value

The return value is a Logical. The function will return T if OK is selected. It will return F if cancelled, or an error occurred.

Error Messages from CreateLegendDlg()

If the source_win is not a Layout, or an embedded Map window on the current Layout page:
  • 1506 "Error: Expecting Layout Window with one ore more embedded Maps, or a single Map Window embedded in a Layout."
If the layout_frame_id doesn't exist on the current page, or is not an empty frame:
  • 1698 "Layout frame <layout_frame_id> must be empty."
If the source_win is a Layout that has no maps on its current page, or all the maps on the current page already have all their legends created:
  • 1507 "Error: No maps were found that can contribute legends."