STK X Send comments on this topic.
KeyPress Event (AgUiAxGfxAnalysisCntrl)
See Also  Example
KeyAscii
An integer that returns a standard numeric ANSI keycode. KeyAscii is passed by reference; changing it sends a different character to the control. Changing KeyAscii to 0 cancels the keystroke so the control receives no character.
Windows






Windows & Linux

Description

Occurs when the user presses and releases a key or key combination that corresponds to an ANSI code.

Syntax

[Visual Basic .NET]
Public Event KeyPress( _
   ByRef KeyAscii As Integer _
)

[C#]
public void KeyPress(
ref int KeyAscii
);

[Managed C++]
public: void KeyPress(
int ^ KeyAscii
);

[Java]
public  keyPress(
ppInteger KeyAscii
);

[Unmanaged C++]
public: HRESULT KeyPress(
int * KeyAscii
);

Parameters

KeyAscii
An integer that returns a standard numeric ANSI keycode. KeyAscii is passed by reference; changing it sends a different character to the control. Changing KeyAscii to 0 cancels the keystroke so the control receives no character.

Remarks

A KeyPress event can involve any printable keyboard character, the CTRL key combined with a character from the standard alphabet or one of a few special characters, and the ENTER or BACKSPACE key. A KeyPress event procedure enables you to immediately test keystrokes for validity or to format characters as they're typed. Changing the value of the KeyAscii argument changes the character received by the control.

Use KeyDown and KeyUp event procedures to handle any keystroke not recognized by KeyPress, such as function keys, editing keys, navigation keys, and any combinations of these with keyboard modifiers. Unlike the KeyDown and KeyUp events, KeyPress doesn't indicate the physical state of the keyboard; instead, it passes a character.

KeyPress interprets the uppercase and lowercase of each character as separate key codes and, therefore, as two separate characters. KeyDown and KeyUp interpret the uppercase and lowercase of each character by means of two arguments: KeyCode, which indicates the physical key (thus returning A and a as the same key), and Shift, which indicates the state of shift+key and therefore returns either A or a.

 

In VB.NET the KeyPress event is shown as  "xxxxxxxx_KeyPressEvent" in the IDE.

Example

[Visual Basic .NET] Copy Code
Private Sub AxAgUiAxGfxAnalysisCntrl1_KeyPressEvent( _
                            ByVal sender As Object, _
                            ByVal e As AxAGI.STKX.IAgUiAxGfxAnalysisCntrlEvents_KeyDownEvent) _
                  Handles AxAgUiAxGfxAnalysisCntrl1.KeyPressEvent

    If (e.keyAscii = System.Windows.Forms.Keys.A) Then
        ' A (uppercase A) key has been pressed!
        ...
    End If

End Sub

See Also

© 2017 Analytical Graphics, Inc. All Rights Reserved.

STK Engine for UNIX 11.2