Purpose
Creates a rectangle or square object. You can issue this statement from the MapBasic window in MapInfo Pro.
Syntax
Create Rect
[ Into { Window window_id | Variable var_name } ]
( x1, y1 ) ( x2, y2 )
[ Pen ... ]
[ Brush ... ] [ Priority n ] [ Name framename ]
window_id is a window identifier.
var_name is the name of an existing object variable.
x1, y1 specifies the starting corner of the rectangle.
x2, y2 specifies the opposite corner of the rectangle.
Pen is a valid Pen clause to specify a line style.
Brush is a valid Brush clause to specify fill style.
n is an integer value indicating the Z-Order value of objects (frames) on the Layout window.
framename is a string representing the name for this item in a Layout window.
Description
If the Create Rect statement includes the optional Into Variable clause, the object will be stored in the specified object variable. If the Into clause specifies a Window identifier, the object will be stored in the appropriate place in the window (for example, in the editable layer of a Map window). If the Into clause is not provided, MapBasic will attempt to store the object in the topmost window; if objects may not be stored in the topmost window (for example, if the topmost window is a grapher) no object will be created.
The x and y parameters use whatever coordinate system MapBasic is currently using. By default, MapBasic uses a Longitude/Latitude coordinate system, although the Set CoordSys statement can re-configure MapBasic to use a different coordinate system. Note that MapBasic's coordinate system is independent of the coordinate system of any Map window. Objects created on a Layout window, however, are specified in paper units: each x-coordinate represents a distance from the left edge of the page, while each y-coordinate represents the distance from the top edge of the page. For details about paper units, see Set Paper Units statement. By default, MapBasic uses inches as the default paper unit. To use a different paper unit, call the Set Paper Units statement.
The optional Pen clause specifies a line style; see Pen clause for more details. If no Pen clause is specified, the Create Rect statement uses the current line style (the style which appears in the Line Style dialog box). Similarly, the optional Brush clause specifies a fill style; see Brush clause for more details.
When creating a clone statement or saving a workspace, MapInfo Pro normalizes the priority of frames to a unique set of values beginning with one (1). Use the Priority clause to assign the Z-Order of the newly created object frame on the Layout window.
The Name clause assigns a name to a frame in the Layout window. If a name is assigned, it is written to the workspace (WOR) file and the workspace version updates to 1500.
See Also:
Brush clause, Create RoundRect statement, Insert statement, Pen clause, Update statement