Keyboard Shortcuts for Clipboard or Undo Actions are not Working
Applies to: yFiles FLEX 1.6, 1.5, 1.4, 1.3 print article email article

Type: Troubleshooting

Categories this article belongs to:
yFiles FLEX > Displaying and Editing Graphs > User Interaction

In certain browsers (e.g. Internet Explorer) some keyboard shortcuts are not working. This article describes the reason for this issue and how to fix it.

The Problem

Some browsers catch the keyDown events standard shortcuts such as Ctrl-C. Microsoft's Internet Explorer is the most prominent example. As the GraphEditorInputMode listens to keyDown events these common shortcuts don't work in these browsers.

The Fix

Fortunately, the keyUp events are still dispatched to the Flex application. So, a possible fix is to create a custom KeyboardInputMode which "fakes" keyDown events when a keyUp event is dispatched without a preceeding keyDown event.

Such a modified input mode can be downloaded as resource. The link can be found at the bottom of this article. The custom input mode can be registered at the GraphEditorInputMode when the input mode is initialized:

graphEditorInputMode.keyboardInputMode = new ShortcutKeyboardInputMode();

Or alternatively in MXML:

<yworks:GraphCanvasComponent id="graphCanvas" width="100%" height="100%">
  <yworks:inputMode>
    <yworks:GraphEditorInputMode id="geim">
      <yworks:keyboardInputMode>
        <input:ShortcutKeyboardInputMode/>
      </yworks:keyboardInputMode>
    </yworks:GraphEditorInputMode>
  </yworks:inputMode>
</yworks:GraphCanvasComponent>

The ShortcutKeyboardInputMode also listens to cut, copy, paste, and selectAll events. These events are dispatched when the user presses the shortcut which is specific for the user's system. E.g. on a Mac, the copy event will be dispatched when the user presses Command+C and not Ctrl+C.

Note that these events are dispatched by Flash Player 10. Thus using these events requires Flex 3.2 and higher and the target player set to 10.0.0 in the compiler settings.

To use the ShortcutKeyboardInputMode with Flash Player 9 simply follow the instructions in the source code.


Keywords: keyboard shortcuts - keyboard - undo - clipboard - internet explorer

Provide feedback:
How useful was this article?    less 1 2 3 4 5 more
Email address (optional):
COPYRIGHT © 2012 yWorks · ALL RIGHTS RESERVED imprint | terms of use | privacy policy | home