LegendFrameInfo() 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

Returns information about a frame within a legend. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

LegendFrameInfo( window_id, frame_id, attribute )

window_id is a number that specifies which legend window you want to query.

frame_id is a number that specifies which frame within the legend window you want to query. Frames are numbered 1 to n where n is the number of frames in the legend.

attribute is an integer code indicating which type of information to return. For values, see the table later in this description.

Return Value

Depends on the attribute parameter, see the table later in this description.

Description

The window_id parameter specifies which window to query. To obtain a window identifier, call the FrontWindow() function immediately after opening a window, or call the WindowID() function at any time after the window's creation.

There are several attributes that LegendFrameInfo() returns about any given Legend window. The attribute parameter tells the LegendFrameInfo() function what Legend window statistic to return. The attribute parameter should be one of the codes from the following table; codes are defined in MAPBASIC.DEF.

Attribute Parameter ID LegendFrameInfo() Return Value
FRAME_INFO_TYPE 1 Returns one of the following predefined constant indicating frame type:
  • FRAME_TYPE_NONE (0)
  • FRAME_TYPE_STYLE (1)
  • FRAME_TYPE_THEME (2)
  • FRAME_TYPE_RASTER (3)
FRAME_INFO_MAP_LAYER_ID 2 Returns the ID of the layer to which the frame corresponds.
FRAME_INFO_REFRESHABLE 3 Returns TRUE if the frame was created without the Norefresh keyword. Always returns TRUE for theme frames.
FRAME_INFO_POS_X 4 Returns the distance of the frame's upper left corner from the left edge of the legend canvas (in paper units).
FRAME_INFO_POS_Y 5 Returns the distance of the frame's upper left corner from the top edge of the legend canvas (in paper units).
FRAME_INFO_WIDTH 6 Returns the width of the frame (in paper units). For details about paper units, see Set Paper Units statement.
FRAME_INFO_HEIGHT 7 Returns the height of the frame (in paper units).
FRAME_INFO_TITLE 8 Returns the title of a style frame or theme frame.
FRAME_INFO_TITLE_FONT 9 Returns the font of a legend frame title. If the frame has no title, returns the default title font.
FRAME_INFO_SUBTITLE 10 Returns the subtitle of a style frame or theme frame.
FRAME_INFO_SUBTITLE_FONT 11 Same as FRAME_INFO_TITLE_FONT (9)
FRAME_INFO_BORDER_PEN 12 Returns the pen used to draw the border in a Cartographic Legend or Theme Legend window.

This is not supported with Legend windows and returns a hollow (invisible) pen style: Pen (0, 1, 0).

FRAME_INFO_NUM_STYLES 13 Returns the number of styles in a frame.
FRAME_INFO_VISIBLE 14 Returns TRUE if the frame is visible (theme frames can be invisible).
FRAME_INFO_COLUMN 15 Returns the legend attribute column name as a string if there is one. Returns an empty string for a theme frame.
FRAME_INFO_LABEL 16 Returns the label expression as a string if there is one. Returns an empty string for a theme frame.
FRAME_INFO_COLUMNS 17 Returns the number of columns in a legend frame. Returns -1 for a Cartographic Legend window.
FRAME_INFO_NUM_VISIBLE_ROWS 18 Returns the number of visible rows in a legend frame. For Cartographic Legend windows (prior to version 11.5), returns -1.
FRAME_INFO_LINE_SAMPLE_WIDTH 19 Returns line sample width in MapBasic paper units. Returns -1 for Cartographic Legend window or raster legend frame displaying a color bar. For details about paper units, see Set Paper Units statement.
FRAME_INFO_REGION_SAMPLE_WIDTH 20 Returns region sample width in MapBasic paper units. Returns -1 for Cartographic Legend window or raster legend frame displaying a color bar. For details about paper units, see Set Paper Units statement.
FRAME_INFO_REGION_SAMPLE_HEIGHT 21 Returns region sample height in MapBasic paper units. Returns -1 for Cartographic Legend window or raster legend frame displaying a color bar. For details about paper units, see Set Paper Units statement.
FRAME_INFO_AUTO_FONT_SIZE 22 Returns the font size in use. Returns -1 for a raster legend frame displaying a color bar.
FRAME_INFO_SHOW_COUNTS 23 Logical. Returns whether the record counts in the legend should be shown per row. This is only meaningful for classified raster legends.
FRAME_INFO_DISPLAY_TYPE 24 DT_INTEGER. Returns a code that describe the way legend rows (the swatches and text) are drawn in a legend frame. This is only meaningful for raster legends, but all legend frames will return one of these values:
  • FRAME_DISPLAY_TYPE_NOT_SPECIFIED (0) - all vector and thematic legend frames.
  • FRAME_DISPLAY_TYPE_GAP (1) - Classified raster legends or raster legends created using Display Gap MapBasic.
  • FRAME_DISPLAY_TYPE_PALETTE (2) - Range raster legends or raster legend created using Display Palette MapBasic.
  • FRAME_DISPLAY_TYPE_BAR (3) - Continuous raster legends or raster legends created using Display Bar MapBasic.
FRAME_INFO_BAR_THICKNESS 25 DT_FLOAT. Returns the thickness of the color bar for a continuous raster legend (FRAME_DISPLAY_TYPE_BAR) in the current MapBasic paper units. Returns -1 for any other type of legend frame.
FRAME_INFO_BAR_LENGTH 26 DT_FLOAT. Returns the length of the color bar for a continuous raster legend (FRAME_DISPLAY_TYPE_BAR) in the current MapBasic paper units. Returns -1 for any other type of legend frame.
FRAME_INFO_BAR_IS_HORIZONTAL 27 DT_LOGICAL: returns whether the color bar is horizontal. Returns true for horizontal color bar. Returns false for vertical color bar, or any other type of legend frame.

See Also:

FrontWindow() function, LegendInfo() function, LegendTextFrameInfo() function, LegendStyleInfo() function, WindowID() function