Shape Selection Overview
This page discusses the following topics:
Selection/Delselection
with the Mouse
Setting
the Color of Selected Shapes
Net
Selection
Copying
Shapes with the Mouse
Selection/Deselection
Programmatically
Returning
Information About the Selected Shape
Selection
and Group Shapes
Additional
Routines
Shape selection can occur either by the user with the mouse, or programmatically. Shapes can be selected
depending on the properties of the layer they reside on. The LayerAction
property sets whether or not shapes can be selected for a particular layer.
When a shape is selected, the ShapeNumberSelected
event is fired.
Selection/Deselection with the Mouse
A shape can be selected by clicking on its border when ViewMouseTool is set to 1. ShapeSearchMethod and LayerSearchMethod can be set to allow shapes to be selected inside the area they contain.
If no keys are held down, a left mouse click will select a single shape. To add a shape to the selection buffer without clearing it, hold down the SHIFT key while clicking on the shape. Likewise, holding the SHIFT key down and clicking on a selected shape will deselect that shape. (This functionality is controlled by the ViewKeySelect property).
Setting the Color of Selected Shapes
ViewSelectMode
sets or returns whether or not shapes keep their color state when selected.
By default, shapes do not keep their color state when selected. The buffer layers' color state is
used instead. So, if you want to change the color of selected shapes (i.e., make all selected shapes red)
you would manipulate the buffer layers' color state. See Colors
Overview information on manipulating color states.
Net selecting is where a rubber-banding rectangle is used to select any shapes that intersect it. The selection rectangle can be drawn with the mouse, by setting ViewMouseTool to -1. Net selecting can also be done programmatically via ShapeSelectRect (note that the selection rectangle will not actually appear in the control view).
This feature is controlled by the ViewKeyCopy property. If the CTRL key is held down while selecting a shape, a copy of the shape will be made and becomes under the control of the mouse. Drag and drop the copied shape to a new location. To set whether or not copying should keep the original shapes' color state, use ViewCopyMode.
Selection/Deselection Programmatically
Shapes can be selected programmatically with ShapeSelect.
With this method, the selection buffer can be cleared before selecting the shape. Net selection is possible
with ShapeSelectRect.
To completely clear the selection buffer, pass a -1 for the shape number to ShapeSelect.
Returning Information About the Selected Shape
Several read-only properties return information about the last selected shape:
ShapeSelectNumber returns the shape number.
ShapeSelectLayer
returns the layer the shape resides on.
ShapeSelectPoint
returns the point of the shape being dragged (if any).
ShapeSelectType returns the type of the shape.
Group shape selection is affected by both LayerAction
and GroupAction.
When GroupAction is set to its default, clicking on a group shape will select all of the shapes
contained in the group, and they can be moved together. When a group shape is selected, information about
that group shape is returned in the routines mentioned above.
GroupAction is provided so that individual shapes in the group to be selected, moved, and resized.
Changing this value will make it so that the group shape as a whole cannot be selected or moved; only
the individual shapes in the group can be manipulated. You should be sure to restore the GroupAction
to its default after manipulating its internal shapes.
ShapeIsSelected
returns the selected status of a shape.
ShapeSelectDelete
deletes all shapes in the selection buffer.
ShapeSelectMoveDelta moves the shapes a given delta X and Y.
ShapeSelectCount returns the number of shapes in the selection buffer.
GroupAddSelection
adds the selected shapes to an already existing group shape.
ShapeHitTest
can be used to return the number of the shape that contains a passed point value.
![]() |
Last modified on: Tuesday, February 04, 2003