com.smartgwt.client.widgets.form.fields.events

## Class KeyPressEvent

- java.lang.Object
- - com.google.web.bindery.event.shared.Event<H>
  - - com.google.gwt.event.shared.GwtEvent<H>
    - - com.smartgwt.client.event.AbstractSmartEvent<KeyPressHandler>
      - - com.smartgwt.client.widgets.form.fields.events.KeyPressEvent

- All Implemented Interfaces:
    Cancellable

      public class KeyPressEvent
      extends AbstractSmartEvent<KeyPressHandler>
      implements Cancellable

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.gwt.event.shared.GwtEvent

      `com.google.gwt.event.shared.GwtEvent.Type<H>`

  - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.event.AbstractSmartEvent

      `jsObj`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyPressEvent(com.google.gwt.core.client.JavaScriptObject jsObj)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Call this method to attempt to cancel the event.
    `protected void` | `dispatch(KeyPressHandler handler)`
    `static <S extends HasKeyPressHandlers & com.google.gwt.event.shared.HasHandlers> void` | `fire(S source, com.google.gwt.core.client.JavaScriptObject jsObj)` Fires a open event on all registered handlers in the handler manager.If no such handlers exist, this method will do nothing.
    `com.google.gwt.event.shared.GwtEvent.Type<KeyPressHandler>` | `getAssociatedType()`
    `java.lang.Integer` | `getCharacterValue()` If this was a character key, this is the numeric value for the character
    `DynamicForm` | `getForm()` Pointer to the item's form
    `FormItem` | `getItem()` Item over which the keypress occurred
    `java.lang.String` | `getKeyName()` Name of the key pressed (Example: `"A"`, `"Enter"`)
    `static com.google.gwt.event.shared.GwtEvent.Type<KeyPressHandler>` | `getType()` Gets the type associated with this event.
    `boolean` | `isAltKeyDown()` Helper method pointing to `EventHandler.altKeyDown()`
    `boolean` | `isCancelled()`
    `boolean` | `isCtrlKeyDown()` Helper method pointing to `EventHandler.ctrlKeyDown()`
    `boolean` | `isShiftKeyDown()` Helper method pointing to `EventHandler.shiftKeyDown()`

    - ### Methods inherited from class com.google.gwt.event.shared.GwtEvent

      `assertLive, getSource, isLive, kill, revive`

    - ### Methods inherited from class com.google.web.bindery.event.shared.Event

      `setSource, toDebugString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### KeyPressEvent

          public KeyPressEvent(com.google.gwt.core.client.JavaScriptObject jsObj)

  - ### Method Detail

    - #### fire

          public static <S extends HasKeyPressHandlers & com.google.gwt.event.shared.HasHandlers> void fire(S source,
                                                                                           com.google.gwt.core.client.JavaScriptObject jsObj)

      Fires a open event on all registered handlers in the handler manager.If no such handlers exist, this method will do nothing.
      Type Parameters:
        `S` - The event source
      Parameters:
        `source` - the source of the handlers
        `jsObj` - the native event

    - #### getType

          public static com.google.gwt.event.shared.GwtEvent.Type<KeyPressHandler> getType()

      Gets the type associated with this event.
      Returns:
        returns the handler type

    - #### dispatch

          protected void dispatch(KeyPressHandler handler)

      Specified by:
        `dispatch` in class `com.google.gwt.event.shared.GwtEvent<KeyPressHandler>`

    - #### getAssociatedType

          public final com.google.gwt.event.shared.GwtEvent.Type<KeyPressHandler> getAssociatedType()

      Overrides:
        `getAssociatedType` in class `com.google.gwt.event.shared.GwtEvent<KeyPressHandler>`

    - #### cancel

          public void cancel()

      Call this method to attempt to cancel the event. Note for general purpose APIs for managing whether user input is allowed, use `FormItem.change()` or `FormItem.transformInput()` instead.
      Specified by:
        `cancel` in interface `Cancellable`

    - #### isCancelled

          public boolean isCancelled()

      Specified by:
        `isCancelled` in interface `Cancellable`
      Returns:
        true if cancelled

    - #### getItem

          public FormItem getItem()

      Item over which the keypress occurred
      Returns:
        Item over which the keypress occurred

    - #### getForm

          public DynamicForm getForm()

      Pointer to the item's form
      Returns:
        Pointer to the item's form

    - #### getKeyName

          public java.lang.String getKeyName()

      Name of the key pressed (Example: `"A"`, `"Enter"`)
      Returns:
        Name of the key pressed (Example: `"A"`, `"Enter"`)

    - #### getCharacterValue

          public java.lang.Integer getCharacterValue()

      If this was a character key, this is the numeric value for the character
      Returns:
        If this was a character key, this is the numeric value for the character. Note that non-character keys like shift, alt, backspace return null

    - #### isAltKeyDown

          public final boolean isAltKeyDown()

      Helper method pointing to `EventHandler.altKeyDown()`
      Returns:
        true if the alt key is being held down.

    - #### isCtrlKeyDown

          public final boolean isCtrlKeyDown()

      Helper method pointing to `EventHandler.ctrlKeyDown()`
      Returns:
        true if the control key is being held down.

    - #### isShiftKeyDown

          public final boolean isShiftKeyDown()

      Helper method pointing to `EventHandler.shiftKeyDown()`
      Returns:
        true if the shift key is being held down.