com.esri.arcgis.systemUI
Class IToolProxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.systemUI.IToolProxy
All Implemented Interfaces:
ITool, Externalizable, Serializable

public class IToolProxy
extends com.esri.arcgis.interop.Dispatch
implements ITool, Serializable

Provides access to members that define a tool.

Description

Tools are similar to buttons but they also require interaction with the application's display. The Zoom In command is a good example of a tool--you click or drag a rectangle over a map before the display is redrawn to show the map contents in more detail.

When To Use

Use the ITool interface to query the properties of a built-in tool or to create your own COM tool.

When you are creating a new COM tool, you need to implement both the ICommand interface and the ITool interface in your class code. With the ITool interface you can define what occurs on events such as mouse move, mouse button press/release, keyboard key press/release, double-click, and right click.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
ICommand, Serialized Form

Field Summary
 boolean noncastable
           
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef
 
Constructor Summary
  IToolProxy()
           
  IToolProxy(Object obj)
           
protected IToolProxy(Object obj, String iid)
           
 
Method Summary
 void addListener(String iidStr, Object theListener, Object theSource)
           
 boolean deactivate()
          Causes the tool to no longer be the active tool.
 int getCursor()
          The mouse pointer for this tool.
 boolean onContextMenu(int x, int y)
          Context menu event occured at the given xy location.
 void onDblClick()
          Occurs when a mouse button is double clicked when this tool is active.
 void onKeyDown(int keyCode, int shift)
          Occurs when a key on the keyboard is pressed when this tool is active.
 void onKeyUp(int keyCode, int shift)
          Occurs when a key on the keyboard is released when this tool is active.
 void onMouseDown(int button, int shift, int x, int y)
          Occurs when a mouse button is pressed when this tool is active.
 void onMouseMove(int button, int shift, int x, int y)
          Occurs when the mouse is moved when this tool is active.
 void onMouseUp(int button, int shift, int x, int y)
          Occurs when a mouse button is released when this tool is active.
 void refresh(int hdc)
          Occurs when a screen display in the application is refreshed.
 void removeListener(String iidStr, Object theListener)
           
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noncastable

public boolean noncastable
Constructor Detail

IToolProxy

public IToolProxy()

IToolProxy

public IToolProxy(Object obj)
           throws IOException
Throws:
IOException

IToolProxy

protected IToolProxy(Object obj,
                     String iid)
              throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

getCursor

public int getCursor()
              throws IOException,
                     AutomationException
The mouse pointer for this tool.

Remarks

When implementing ITool to create a custom tool, use the Cursor property to set the mouse pointer of the tool.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getCursor in interface ITool
Returns:
The cursor (A COM typedef)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onMouseDown

public void onMouseDown(int button,
                        int shift,
                        int x,
                        int y)
                 throws IOException,
                        AutomationException
Occurs when a mouse button is pressed when this tool is active.

Description

button specifies which mouse button is pressed. The button argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the mouse buttons are pressed. The values for button are as follows:

1 Left button
2 Right button
3 Left and Right buttons
4 Middle button
5 Left and Middle buttons
6 Right and Middle buttons
7 All buttons

Shift indicates whether the Shift key, Ctrl key, or Alt key is pressed when the mouse button is pressed. The Shift argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the keys are pressed. The values for Shift are as follows:

0 No key pressed
1 Shift key pressed
2 Ctrl key pressed
3 Shift and Ctrl keys pressed
4 Alt key pressed
5 Shift and Alt keys pressed
6 Ctrl and Atl keys pressed
7 Shift, Ctrl, and Alt keys pressed

X is the X coordinate, in device units, where the mouse button was pressed.

Y is the Y coordinate, in device units, where the mouse button was pressed.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when the left mouse button is pressed when this tool is the active tool in the OnMouseDown method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onMouseDown in interface ITool
Parameters:
button - The button (in)
shift - The shift (in)
x - The x (in)
y - The y (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onMouseMove

public void onMouseMove(int button,
                        int shift,
                        int x,
                        int y)
                 throws IOException,
                        AutomationException
Occurs when the mouse is moved when this tool is active.

Description

button specifies which mouse button was pressed while moving the mouse. The button argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the mouse buttons are pressed. The values for button are as follows:

1 Left button
2 Right button
3 Left and Right buttons
4 Middle button
5 Left and Middle buttons
6 Right and Middle buttons
7 All buttons

Shift indicates whether the Shift key, Ctrl key, or Alt key is pressed when the mouse is moved. The Shift argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the keys are pressed. The values for Shift are as follows:

0 No key pressed
1 Shift key pressed
2 Ctrl key pressed
3 Shift and Ctrl keys pressed
4 Alt key pressed
5 Shift and Alt keys pressed
6 Ctrl and Atl keys pressed
7 Shift, Ctrl, and Alt keys pressed


X is the X coordinate, in device units, of the mouse location.

Y is the Y coordinate, in device units, of the mouse location.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when the mouse is moved when this tool is the active tool in the OnMouseMove method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onMouseMove in interface ITool
Parameters:
button - The button (in)
shift - The shift (in)
x - The x (in)
y - The y (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onMouseUp

public void onMouseUp(int button,
                      int shift,
                      int x,
                      int y)
               throws IOException,
                      AutomationException
Occurs when a mouse button is released when this tool is active.

Description

button specifies which mouse button is released. The button argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the mouse buttons are pressed. The values for button are as follows:

1 Left button
2 Right button
3 Left and Right buttons
4 Middle button
5 Left and Middle buttons
6 Right and Middle buttons
7 All buttons

Shift indicates whether the Shift key, Ctrl key, or Alt key is pressed when the mouse button is released. The Shift argument is a bit field. Some, all, or none of the bits can be set indicating that some, all, or none of the keys are pressed. The values for Shift are as follows:

0 No key pressed
1 Shift key pressed
2 Ctrl key pressed
3 Shift and Ctrl keys pressed
4 Alt key pressed
5 Shift and Alt keys pressed
6 Ctrl and Atl keys pressed
7 Shift, Ctrl, and Alt keys pressed

X is the X coordinate, in device units, where the mouse button was released.

Y is the Y coordinate, in device units, where the mouse button was released.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a mouse button is released when this tool is the active tool in the OnMouseUp method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onMouseUp in interface ITool
Parameters:
button - The button (in)
shift - The shift (in)
x - The x (in)
y - The y (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onDblClick

public void onDblClick()
                throws IOException,
                       AutomationException
Occurs when a mouse button is double clicked when this tool is active.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a mouse button is double-clicked when this tool is the active tool in the OnDblClick method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onDblClick in interface ITool
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onKeyDown

public void onKeyDown(int keyCode,
                      int shift)
               throws IOException,
                      AutomationException
Occurs when a key on the keyboard is pressed when this tool is active.

Description

keyCode specifies which key on the keyboard was pressed.

Shift indicates whether the Shift key, Ctrl key, or Alt key was pressed when the mouse button was pressed. 0 for no keys pressed. 1 for Shift key pressed. 2 for Ctrl key pressed. 4 for Alt key pressed. If both the Shift key and the Ctrl key were pressed, Shift would be 3. If all three keys were pressed, Shift would be 7.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a key on the keyboard is pressed when this tool is the active tool in the OnKeyDown method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onKeyDown in interface ITool
Parameters:
keyCode - The keyCode (in)
shift - The shift (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onKeyUp

public void onKeyUp(int keyCode,
                    int shift)
             throws IOException,
                    AutomationException
Occurs when a key on the keyboard is released when this tool is active.

Description

keyCode specifies which key on the keyboard was released.

Shift indicates whether the Shift key, Ctrl key, or Alt key was pressed when the mouse button was pressed. 0 for no keys pressed. 1 for Shift key pressed. 2 for Ctrl key pressed. 4 for Alt key pressed. If both the Shift key and the Ctrl key were pressed, Shift would be 3. If all three keys were pressed, Shift would be 7.

Remarks

When implementing ITool to create a custom tool, write the code that performs the action when a key on the keyboard is released when this tool is the active tool in the OnKeyUp method.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onKeyUp in interface ITool
Parameters:
keyCode - The keyCode (in)
shift - The shift (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onContextMenu

public boolean onContextMenu(int x,
                             int y)
                      throws IOException,
                             AutomationException
Context menu event occured at the given xy location.

Description

X is the X coordinate, in device units, where the right mouse button was pressed.

Y is the Y coordinate, in device units, where the right mouse button was pressed.

Remarks

When implementing ITool to create a custom tool, write code to display a custom context menu when the right mouse button is pressed when this tool is the active tool in the OnContext method.

If your tool displays a custom context menu, it should let the application know that it handled the OnContextMenu event by returning True from the OnContext function. If you don't do this, the standard context menu will be displayed after your custom context menu.

This method does not fire in ArcGIS Engine. A context menu is implemented using IToolbarMenu in ArcGIS Engine as illustrated by the ControlsEditingSketchContextMenu command.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
onContextMenu in interface ITool
Parameters:
x - The x (in)
y - The y (in)
Returns:
The handled
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

refresh

public void refresh(int hdc)
             throws IOException,
                    AutomationException
Occurs when a screen display in the application is refreshed.

Description

hDC is the handle to the display context which just got refreshed in the application.

Remarks

When implementing ITool to create a custom tool, write the code in the Refresh method that performs some action when a screen display in the application is refreshed while this tool is the active tool. When the current screen display in the application is refreshed, the handle to the device context that is associated with that screen display is passed into the Refresh method as an argument.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
refresh in interface ITool
Parameters:
hdc - The hdc (A COM typedef) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deactivate

public boolean deactivate()
                   throws IOException,
                          AutomationException
Causes the tool to no longer be the active tool.

Remarks

When implementing ITool to create a custom tool, add some logic to the Deactivate method to specify whether this tool can be deactivated. If ITool_Deactivate is set to False, the default, you cannot interact with any other tools because this tool cannot be interrupted by another tool.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deactivate in interface ITool
Returns:
The complete
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.