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()
- 1506 "Error: Expecting Layout Window with one ore more embedded Maps, or a single Map Window embedded in a Layout."
- 1698 "Layout frame <layout_frame_id> must be empty."
- 1507 "Error: No maps were found that can contribute legends."