Purpose
Returns information about a Layout window, such as: width and height of the layout canvas, margins, zoom level, and layout center. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
LayoutInfo( window_id, attribute )
window_id is an integer window identifier.
attribute is an integer code indicating what 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 LayoutInfo() function returns information about a Layout window. The function does not apply to the classic Layout window.
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 LayoutInfo() returns about any given Layout window. The attribute parameter tells the LayoutInfo() function what Layout 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 | Return Value |
---|---|---|
LAYOUT_INFO_NUM_ITEMS | 1 | Integer value: Returns the number of items in the layout. |
LAYOUT_INFO_WIDTH | 2 | Float value: Width of the layout canvas in paper units. |
LAYOUT_INFO_HEIGHT | 3 | Float value: Height of the layout canvas in paper units. |
LAYOUT_INFO_LEFT_MARGIN | 4 | Float value: Width of the layout’s left margin in paper units. |
LAYOUT_INFO_RIGHT_MARGIN | 5 | Float value: Width of the layout’s right margin in paper units. |
LAYOUT_INFO_TOP_MARGIN | 6 | Float value: Width of the layout’s top margin in paper units. |
LAYOUT_INFO_BOTTOM_MARGIN | 7 | Float value: Width of the layout’s bottom margin in paper units. |
LAYOUT_INFO_ZOOM | 8 | Float value: The layout’s zoom percentage; the default is 100. |
LAYOUT_INFO_CENTER_X | 9 | Float value: The x-coordinate of the center of the layout in paper units. |
LAYOUT_INFO_CENTER_Y | 10 | Float value: The y-coordinate of the center of the layout in paper units. |
LAYOUT_INFO_NUM_PAGES | 11 | Integer value: The number of pages in the layout. |
LAYOUT_INFO_CUR_PAGE | 12 | Integer value: The page number of the visible, or current, page. |
LAYOUT_INFO_GRID_VISIBILITY | 13 | Logical value: TRUE if grid is visible, FALSE otherwise. |
LAYOUT_INFO_GIRD_SNAP | 14 | Logical value: TRUE if grid snap is on, FALSE otherwise. |
LAYOUT_INFO_GRID_SIZE | 15 | Float value: Gridline size or spacing in the current paper unit. |
LAYOUT_INFO_SMART_GUIDES | 16 | Logical value: TRUE if Smart Guides are enabled, FALSE otherwise. |
Paper unit values are in inches by default. To change the paper units, use the Set Paper Units statement.
See Also:
FrontWindow() function, LayoutItemInfo() function, Set Paper Units statement, WindowID() function