LayoutItemID() 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 a frame ID within a Layout window. In a multi-page layout, this function only searches the current page selection. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

LayoutItemID( window_id, frame, frame_type )

window_id is an integer window identifier.

frame can be a string representing the name of the frame. Use empty double-qoutes ("") for unnamed frames. Value can also be a number representing the nth from of the specified type.

frame_type is SmallInt representing the type of layout frame to search for. Use one of the LAYOUT_ITEM_INFO_TYPE values below.

The following lists the frame type returned using LAYOUT_ITEM_INFO_TYPE.

Frame Type ID Frame Description
LAYOUT_ITEM_TYPE_ANY -1 The first frame found with the specified name, regardless of what type of frame it is.
LAYOUT_ITEM_TYPE_EMPTY 0 An empty frame: a frame with no content.
LAYOUT_ITEM_TYPE_MAPPER 1 A map frame.
LAYOUT_ITEM_TYPE_BROWSER 2 A browser frame.
LAYOUT_ITEM_TYPE_LEGEND 3 A legend frame.
LAYOUT_ITEM_TYPE_TEXT 4 A text frame.
LAYOUT_ITEM_TYPE_SHAPE 5 A shape frame, such as a line, rectangle, rounded rectangle, or ellipse.
LAYOUT_ITEM_TYPE_IMAGE 6 An image frame.

Paper unit values are in inches by default. To change the paper units, use the Set Paper Units statement.

Return Value

The layout item ID is returned as an integer. If the item is not found, -1 is returned.

Description

The LayoutItemID() function returns a frame ID within 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.

In a multi-page layout, this function only searches the current page selection.

Examples

Dim f as integer 
‘Find Map frame named Map-1  
f = LayoutItemID(frontwindow(), "Map-1", LAYOUT_ITEM_TYPE_MAPPER) 
‘Find 2nd Map frame 
f = LayoutItemID(frontwindow(), 2, LAYOUT_ITEM_TYPE_MAPPER) 

See Also:

FrontWindow() function, LayoutInfo() function, LayoutItemInfo() function, Set Paper Units statement, WindowID() function