Purpose
Returns information about adornments like scale bars. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
AdornmentInfo( window_id, attribute )
window_id is an integer window identifier. The window needs to be an adornment.
attribute is an integer code indicating what type of information to return. For values, see the table below:
Return Value
Float, smallint, integer, logical, pen, brush, font, or string, depending on the attribute parameter.
Description
There are several attributes that AdornmentInfo() can return. Codes are defined in MAPBASIC.DEF.
Attribute setting | ID | AdornmentInfo() Return Value |
---|---|---|
ADORNMENT_INFO_TYPE | 1 |
Integer. Type of adornment: 0 (zero) for scale bar. Integer. Type of adornment: 1 (one) for Table Adornment. Integer. Type of adornment: 2 (two) for Image. Integer. Type of adornment: 3 (three) for XTEST. Integer. Type of adornment: 4 (four) for Smart Text. |
ADORNMENT_INFO_MAP_WINDOWID | 2 | Integer. WindowID of the parent map window. |
ADORNMENT_INFO_IS_FIXED_POS | 3 | Logical. True for fixed position, false for docked position. |
ADORNMENT_INFO_FIXED_POS_X | 4 | Float. X value of the fixed position. |
ADORNMENT_INFO_FIXED_POS_Y | 5 | Float. Y value of the fixed position. |
ADORNMENT_INFO_FIXED_POS_UNITS | 6 | Char. Units of the X and Y offsets for the docked position. |
ADORNMENT_INFO_DOCKED_POS | 7 | SmallInt. Returns the docked position. |
ADORNMENT_INFO_DOCKED_OFFSET_X | 8 | Float. X value of the offset relative to the docked position. |
ADORNMENT_INFO_DOCKED_OFFSET_Y | 9 | Float. Y value of the offset relative to the docked position. |
ADORNMENT_INFO_DOCKED_UNITS | 10 | Char. Units of the X and Y offsets for the docked position. |
ADORNMENT_INFO_BACKGROUND_PEN | 11 | Pen. The style of the adornment background border pen. |
ADORNMENT_INFO_BACKGROUND_BRUSH | 12 | Brush. The style of the adornment background fill brush. |
ADORNMENT_INFO_SB_TYPE | 20 | SmallInt. Type of scale bar. |
ADORNMENT_INFO_SB_MAP_UNITS | 21 | Char. Units of the map distance on the scale bar. |
ADORNMENT_INFO_SB_PAPER_UNITS | 22 | Char. Paper units in the scale bar. For details about paper units, see Set Paper Units statement. |
ADORNMENT_INFO_SB_BAR_LENGTH | 23 | Float. Original size of the scale bar. |
ADORNMENT_INFO_SB_BAR_DRAW_LEN | 24 | Float. Size the scale bar is drawn at. |
ADORNMENT_INFO_SB_BAR_HEIGHT | 25 | Float. Height of the scale bar. |
ADORNMENT_INFO_SB_AUTO_SCALING | 26 | Logical. To mark auto scaling on or off. |
ADORNMENT_INFO_SB_CARTO_SCALE | 27 | Logical. To display the cartographic scale in the toolbar. |
ADORNMENT_INFO_SB_BAR_PEN | 28 | Pen. The pen style used to draw the scale bar. |
ADORNMENT_INFO_SB_BAR_BRUSH | 29 | Brush. The brush, fill style used to draw the scale bar. |
ADORNMENT_INFO_SB_BAR_FONT | 30 | Font. The font used to render text in the scale bar. |
ADORNMENT_INFO_SB_DISPLAY_SCALE | 31 | Float. The numeric value of the scale that will be shown in the scale bar. |
ADORNMENT_INFO_SB_AUTOOFF_SCALE | 32 | Float. The unrounded scale value that is used if auto scaling is off. |
ADORNMENT_INFO_SB_AUTOON_SCALE | 33 | Float. The rounded scale value that is used if auto scaling is on. |
ADORNMENT_INFO_SB_SCALE_STRING | 34 | Char. The scale value that is being displayed but as a formatted string (such as decimal points, thousands separators). |
ADORNMENT_INFO_SB_CARTO_VALUE | 35 | Float. The cartographic scale value as a numeric value, without any rounding. |
ADORNMENT_INFO_SB_CARTO_STRING | 36 | Char. The cartographic scale as a formatted string. |
ADORNMENT_INFO_ST_TEXT |
37 | Smart Text. |
ADORNMENT_INFO_ST_EVALUATED_TEXT | 38 | Evaluated Smart Text. |
ADORNMENT_INFO_ST_FONT | 39 | Smart Text Font. |
Example
print AdornmentInfo(MapperInfo(FrontWindow(), 201), 1)