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

To create more useful Smart Text, a new MapBasic function, LayoutItemWinID has been Introduced. This function makes it easier to create text that displays information about other frames, like map frames.

Purpose

Returns a MapInfo Pro window identifier associated with the frame named 'frame_name' with type 'frame_type'. In a multi-page layout, this function searches all pages starting with the current page. You can call this function from the MapBasic window in MapInfo Pro.

Syntax
LayoutItemWinID(window_id, frame, frame_type)
  • window_id is an integer window identifier for a Layout window.
  • frame can be a string or number 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 frame type can only be a map, browser, or legend frame.
Frame Type ID Frame Description
LAYOUT_ITEM_TYPE_MAPPER 1 A map frame.
LAYOUT_ITEM_TYPE_BROWSER 2 A browser frame.
LAYOUT_ITEM_TYPE_LEGEND 3 A legend frame.
Return Value

Returns the window ID for the layout item (frame) as an integer.

Description

Returns the window ID for the layout item (frame) as an integer. For legend frames. Returns the window ID for the parent Legend window. This value can be used in Legend MapBasic statements such as Alter Designer Frame or functions such as LegendFrameInfo(). If the item is not found, MapBasic error 1068 is set and 0 is returned. 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 Layout window, or call the WindowID() function at any time after the window's creation.

In a multi-page layout, this function first searches the current page. If the frame is not found, it continues searching forward over subsequent pages, then wraps to the beginning page searching up until the current page.

MapBasic error 1068 = "A frame with the name 'frame_name' and type 'frame_type'
could not be found."