GoDiagram Web Reference
ReplaceMouseTool Method

the Type of the tool to be replaced; this should not be a base class of the actual tool instance type
the tool to use instead of the existing one of Typetooltype; if null, the old tool is only removed
Replace one of the "mode-less" tools used by this view.
Syntax
'Declaration
 
Public Overridable Function ReplaceMouseTool( _
   ByVal tooltype As Type, _
   ByVal newtool As IGoTool _
) As IGoTool
public virtual IGoTool ReplaceMouseTool( 
   Type tooltype,
   IGoTool newtool
)

Parameters

tooltype
the Type of the tool to be replaced; this should not be a base class of the actual tool instance type
newtool
the tool to use instead of the existing one of Typetooltype; if null, the old tool is only removed

Return Value

the tool that was replaced, or null if no such instance was found
Remarks
When you want to customize an existing "mode-less" tool, and when setting one of its properties is insufficient, you may need to define your own subclass of that tool or define your own tool inheriting from GoTool. In order for the view to use your tool, you'll need to create an instance of your tool class for the view, and then you can either set Tool explicitly, or let GoToolManager find your tool in one of the mouse tool lists, such as MouseDownTools. For the latter case, you could just add an instance of your tool to one of those lists. But often you will not want to allow the instance of the original tool class to be used. This method makes it easy to replace an existing tool with a different one. This method searches all of the lists of mode-less tools: , , .
Example
You have defined a new subclass of GoToolLinkingNew, called CustomLinkTool. For each view that you want to use of this new tool instead of the standard way for users to draw new links, call aView.ReplaceMouseTool(typeof(GoToolLinkingNew), new CustomLinkTool(aView))
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GoView Class
GoView Members
FindMouseTool(Type) Method

 

 


© 2013. Northwoods Software Corporation. All Rights Reserved.

Send Feedback