Description

Select a graphic tool used to create and manipulate graphic objects.

Return Type

A McGraphToolServer object.  

A new McGraphToolServer instance for the selected tool or Nothing if no tool is selected (both ToolClassName and GraphObjClassName are empty). See the ActiveTool property for more discussion. The returned instance must be released before the active McGraphOverlay can be released.

Syntax

object.SelectTool ([ToolClassName], [GraphObjClassName], [TemplateID])

The SelectTool Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McGraphOverlay.
ToolClassNameOptional. A String value.

The tool class name. If this is an empty string (the default), then the either no tool is being selected (GraphObjClassName is also an empty string) or a built-in creation tool for some graphic object is being selected (GraphObjClassName is the class name of the type of object being created). If it is “McGraphToolSelect”, then the built-in object selection tool is becomes the current tool. Otherwise it must be the ProgID of some custom tool class exposing an McGraphToolServer interface and either the _IMcBasicViewEvents custom interface or the _IMcViewEvents dispinterface.

GraphObjClassNameOptional. A String value.

The class name of the graphic objects to create. This string is ignored when ToolClassName is “McGraphToolSelect”. If this is an empty string (the default) and ToolClassName is also an empty string then no tool is active.

TemplateIDOptional. A Long value.

The template used when creating new graphic objects. This is mcgtDefaultTemplate (0) by default.

Remarks

Builtin tool classes are McGraphToolSelect, McGraphToolRect, and McGraphToolPoly. Instances of user defined classes implementing McGraphToolServer can also be selected using the standard ServerName.ObjectName syntax (ServerName can be omitted builtin classes). McGraphToolPoly can only be used to create McGraphObjPoly objects, while McGraphToolRect will be used for all other built-in objects. McGraphToolSelect is used to select, resize or move existing objects.

Tools can also be used to create instances of user defined classes implementing the McGraphObjServer interface: GraphObjClassName should use the standard ServerName.ObjectName syntax (ServerName can be omitted for builtin classes).

Notes

Calling SelectTool sets the value of any ancestor McImage's LastActiveTool property. This will be the same as the return value from this method. This instance of McGraphOverlay will not be fully released until the return value of the SelectTool call has been released and also the McImage.LastActiveTool property has been assigned Nothing.

For custom tools, the returned McGraphToolServer is the actual custom tool instance, but the McGraphToolServer placed into the McImage.LastActiveTool property is a separate McGraphToolServer instance holding a copy of the custom tool's properties. The reason for doing this is that you will want to have access to the actual custom tool for access to information about its current state and also to access any extra control interfaces that it might expose. But the McImage.LastActiveTool property must survive the shut-down of the custom tool when some other image's overlay gets a SelectTool call.