ArcObjects Library Reference  (SystemUI)    

ITool.OnKeyDown Method

Occurs when a key on the keyboard is pressed when this tool is active.

[Visual Basic 6.0]
Sub OnKeyDown(
    ByVal keyCode As Long, _
    ByVal shift As Long _
)
[Visual Basic .NET]
Public Sub OnKeyDown ( _
    ByVal keyCode As Integer, _
    ByVal shift As Integer _
)
[C#]
public void OnKeyDown (
    int keyCode,
    int shift
);
[Java]
public void onKeyDown (
    int keyCode,
    int shift
)
throws
    IOException,
    AutomationException
[C++]
HRESULT OnKeyDown(
  long keyCode,
  long shift
);
[C++]

Parameters

keyCode [in]

  keyCode is a parameter of type long

shift [in]

  shift is a parameter of type long

Product Availability

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

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.

[Visual Basic 6.0]
Private Sub ITool_OnKeyDown(ByVal keyCode As Long, ByVal Shift As Long)
  ' Add some code to do some action when a keyboard button is pressed.
  ' This example changes the statusbar message.
  ' m_pApp is set in ICommand_OnCreate.
  m_pApp.StatusBar.Message(0) = "ITool_OnKeyDown"
End Sub 

See Also

ITool Interface

Example

ITool Example

 


Feedback Send feedback on this page