Create Empty Frames - 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

The Create Frame statement can also be used to create empty frames for the Layout window. Empty frames are used to add template functionality for Layouts and create place-holders at any position, of any valid frame size.

Syntax

Create Frame 
	[ Into { Window window_id | Variable var_name } ] 
	( x1, y1 ) ( x2, y2 ) 
	[ Pen... ] 
	[ Brush... ]
	[ Priority n ]
	[ Name framename ]

If window_id refers to a Layout window, a new empty frame will be created. If it refers to a classic Layout window, the legacy empty frame will still be created. For background on classic Layout windows, see Working with Classic Layout Windows.

If Name is omitted the default text will be "" (empty string). Names will be displayed in the center of the frame. Long names (names wider than the current width of the empty frame) will wrap.

If Pen is omitted default pen will be a single pixel solid black line.

If Brush is omitted default brush will be a transparent brush (no fill).If Priority is omitted the frame is added as the topmost.

The empty frame is counted as a frame like any other and added to the frame count returned by LayoutInfo().The Pen, Brush, Name, and Priority properties can be modified after the frame is created using Alter Designer Frame statement. Position and size can also be modified using Alter Designer Frame or by clicking and dragging the frame in the GUI. The frame border and fill (pen and brush) can be modified in the GUI using the Frame Properties dialog.

Adding Content to Empty Frames

Only maps and browsers can be inserted into empty frames. There are two ways of inserting a map or browser window into an empty frame:
  1. Using the Set Designer Frame statement
    Set Designer Frame 
    	[ Window layout_window_id ]
    	[ ID empty_frame_id ] 
    	From { Window map_or_browser_window_id  } 

    If ID is an empty frame, then when followed by From Window clause, the empty frame is populated by a clone of the original map or browser.

  2. Using the Map From and Browse From statements
    Use these statements to insert currently open tables into the empty frame. For example,
    Map From World, World_Cities Into Window layout_win_id Id empty_frame_id
    This will create a map for the open tables called World and World_Cities and insert it into the empty frame in the Layout Designer window. A default view of the map will be displayed. The frame properties already set for the empty frame will also be retained (pen, brush, position, size, name, and z-order).
Reusing the Empty Frame
To reuse a frame after it has been filled with content, it needs to be emptied.
Set Designer Frame [ Window layout_window_id ] Id { frame_id } Clear
This leaves an empty frame of the same size and position as the content it just contained, and retains the name currently assigned to it. The content itself is destroyed; meaning, the map or browser goes away. Other frame properties such as the border pen, fill brush, and z-order remain unchanged.

Browsers, Maps, Legends, Shapes, Images, and Text can be removed using this command. The command can also be used on an empty frame. If you clear a Map frame and it has legend frames associated with it, the legend frames will be removed from the layout.