Skip to main content

Viewport:register_view()

Viewport:register_view(param_table)

This method registers a new view to the viewport.

Parameters

ParameterTypeDescription
param_tabletableThis parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section.

Parameters Table

KeyTypeDescription
namestringUser-assigned name for the view.
This parameter is required.
elementstableGeometry information for all view elements to be placed on the view.
It specifies an array table of View Element Region Definition table.
This parameter is required.
mappingstableEvent-Action mapping array.
It specifis an array table of Event-Action mapping definiton.The Event-Action mappings specified by this parameter are effective only while this view is displayed as the current view.
backgroundColor,
Bitmap
Brush object to fill the background of the view.
If a bitmap object is specified, it will be scaled to fit the entire view both horizontally and vertically. Please note that if the aspect ratios of the view and the bitmap are different, the image may be distorted.
logical_widthnumberSpecifies the logical width of the view.
It determines the aspect ratio of the view, along with logical_height, and sets the unit length in the logical coordinate system. If this parameter is specified, the coordinate system for the view will be absolute coordinate system.
This parameter and aspect_ratio are mutually exclusive.
logical_heightnumberSpecifies the logical height of the view. Refer to the description for lgical_width.
aspect_rationumberSpecifies the aspect ratio of the view.
If this parameter is specified, the coordinate system for the view will be relative coordinate system.
This parameter and the pair of logical_width and logical_height are mutually exclusive.
horizontal_alignmentstringSpecifies how to align the view horizontally when the aspect ratio of the viewport's active area and the aspect ratio of the view differ. It specifies either of center, left, or right.
The default is center.
vertical_alignmentstringSpecifies how to align the view vertically when the aspect ratio of the viewport's active area and the aspect ratio of the view differ. It specifies either of center, top, or bottom.
The default is center.

View Element Region Definition

KeyTypeDescription
objectOperableArea,
Canvas,
CapturedWindow
Viewelement object.
This parameter is required.
xnumberX-coordinate of the top-left corner of the view element.
The default is 0.
ynumberY-coordinate of the top-left corner of the view element.
The default is 0.
widthnumberWidth of the view element.
The default is the width of the viewport's active area.
heightnumberHeight of the view element.
The default is the width of the viewport's active area.

Return Values

This function returns the view ID associated with the registered view.

See Also