The Selection collection contains all the properties and methods associated with the collection of selected objects. The Selection collection defines methods that operate on one or more selected objects. This includes moving and sizing one or more shapes; cut, copy, and paste; and setting the Z order of multiple shapes. Most commands within MapViewer that require selected objects are part of the Selection collection. The Selection collection allows all selected objects to be enumerated.
Properties
Methods
Item*
*default method
Example
The following script selects an object and references the Selection collection for the current layer.
Sub Main
'Declares mvApp as an object
Dim mvApp As Object
'Creates an instance of the MapViewer Application
'object and assigns it to the variable named "mvApp"
Set mvApp = CreateObject("MapViewer.Application")
'Makes MapViewer visible
mvApp.Visible = True
'Declares Plot as an object
Dim Plot As Object
'Creates a map document in MapViewer and
'assigns it to the variable named "Plot"
Set Plot = mvApp.Documents.Add(mvDocPlot)
'Declares PlotLayers as an object
Dim PlotLayers As Object
'Assigns the map document layers to the
'variable named "PlotLayers"
Set PlotLayers = Plot.Layers
'Declares CurrentLayer as an object
Dim CurrentLayer As Object
'Assigns the active plot layer to the
'variable named "CurrentLayer"
Set CurrentLayer = PlotLayers.ActiveLayer
'Assign the shapes collection to the
'variable named "MapShapes"
Set MapShapes = CurrentLayer.Shapes
'Declares Ellipse as an object
Dim Ellipse As Object
'Creates an ellipse and assigns it to the
'variable named "Ellipse"
Set Ellipse = MapShapes.AddEllipse(4, 5, 8, 3)
'Select the ellipse shape
Ellipse.Select
'Assign the Selection collection to the
'variable named "Selection"
Set Selection = CurrentLayer.Selection
End Sub