creates a key event
553810
function( type, options, element ) { //Everyone Else
				var doc = h.getWindow(element).document || document;
				if ( doc.createEvent ) {
					var event;

					try {

						event = doc.createEvent("KeyEvents");
						event.initKeyEvent(type, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.keyCode, options.charCode);
					}
					catch (e) {
						event = h.createBasicStandardEvent(type, options, doc);
					}
					event.synthetic = true;
					return event;
				}
				else {
					var event;
					try {
						event = h.createEventObject.apply(this, arguments);
						h.extend(event, options)
					}
					catch (e) {}

					return event;
				}
			}
323650
def create(self, key, *args, **kwargs):
        
        instance = self._class(key, *args, **kwargs)
        self._events.create.trigger(list=self, instance=instance, key=key, args=args, kwargs=kwargs)
        return self.insert(instance)
1346432
private KeyHook create(KeyBinding key)
    {
        if (key != null && key instanceof KeyHook)
        {
            return (KeyHook)key; // Don't create a KeyHook to replace this KeyBinding, since that has already been done at some point.
            // (Minecraft keeps a pointer to every KeyBinding that gets created, and they never get destroyed - so we don't want to create
            // any more than necessary.)
        }
        return new KeyHook(key.getKeyDescription(), key.getKeyCode(), key.getKeyCategory());
    }
471718
def key_press_handler(event, canvas, toolbar=None):
    
    if event.key is None: return

    key = event.key.encode('ascii', 'ignore')

    if key in ['1']:
        toolbar.create_gate_widget(kind='poly')
    elif key in ['2', '3', '4']:
        kind = {'2': 'quad', '3': 'horizontal threshold', '4': 'vertical threshold'}[key]
        toolbar.create_gate_widget(kind=kind)
    elif key in ['9']:
        toolbar.remove_active_gate()
    elif key in ['0']:
        toolbar.load_fcs()
    elif key in ['a']:
        toolbar.set_axes(('d1', 'd2'), pl.gca())
    elif key in ['b']:
        toolbar.set_axes(('d2', 'd1'), pl.gca())
    elif key in ['c']:
        toolbar.set_axes(('d1', 'd3'), pl.gca())
    elif key in ['8']:
        print(toolbar.get_generation_code())
474321
def key_press_event(self, widget, event):
        
        # get keyname or keycode and translate to ginga standard
        # keyname =
        # keycode =
        keyname = ''  # self.transkey(keyname, keycode)
        self.logger.debug("key press event, key=%s" % (keyname))
        return self.make_ui_callback('key-press', keyname)
802156
function (event) {
            if (this._subTplModuleCtrl) {
                if (!event.isSpecialKey && event.charCode != event.KC_SPACE) {
                    this.sendKey(event);
                }
            }
        }
1228224
def keyPressEvent(self, event):
        """"""
        if event.key() == Qt.Key_Alt:
            self._alt_key_is_down = True
            self.update()
469098
def __create_event(self):
        
        if not event.contains(self.field, 'set', self.__validate):
            event.listen(self.field, 'set', self.__validate, retval=True)
897440
function(context) {
		this._keymap = Object.create(null);
		["keydown", "keypress", "keyup"].forEach(function(type) {
			context.document.addEventListener(type, this, false);
		}, this);
	}
256585
function _keydownHook(event) {
            var keyCode;

            // (page) up, (page) down, enter and tab key are handled by the list
            if (event.type === "keydown") {
                keyCode = event.keyCode;

                if (keyCode === KeyEvent.DOM_VK_TAB) {
                    self.close();
                } else if (keyCode === KeyEvent.DOM_VK_UP) {
                    // Move up one, wrapping at edges (if nothing selected, select the last item)
                    self._tryToSelect(self._selectedIndex === -1 ? -1 : self._selectedIndex - 1, -1);
                } else if (keyCode === KeyEvent.DOM_VK_DOWN) {
                    // Move down one, wrapping at edges (if nothing selected, select the first item)
                    self._tryToSelect(self._selectedIndex === -1 ? 0 : self._selectedIndex + 1, +1);
                } else if (keyCode === KeyEvent.DOM_VK_PAGE_UP) {
                    // Move up roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the first item)
                    self._tryToSelect((self._selectedIndex || 0) - self._itemsPerPage(), -1, true);
                } else if (keyCode === KeyEvent.DOM_VK_PAGE_DOWN) {
                    // Move down roughly one 'page', stopping at edges (not wrapping) (if nothing selected, selects the item one page down from the top)
                    self._tryToSelect((self._selectedIndex || 0) + self._itemsPerPage(), +1, true);

                } else if (keyCode === KeyEvent.DOM_VK_HOME) {
                    self._tryToSelect(0, +1);
                } else if (keyCode === KeyEvent.DOM_VK_END) {
                    self._tryToSelect(self.$items.length - 1, -1);

                } else if (self._selectedIndex !== -1 &&
                        (keyCode === KeyEvent.DOM_VK_RETURN)) {

                    // Trigger a click handler to commmit the selected item
                    self._selectionHandler();
                } else {
                    // Let the event bubble.
                    return false;
                }

                event.stopImmediatePropagation();
                event.preventDefault();
                return true;
            }

            // If we didn't handle it, let other global keydown hooks handle it.
            return false;
        }
781969
def event_text_key(self, event):
        
        char = event.char
        if not char or char not in string.ascii_letters:
            # ignore all non letter inputs
            return

        converted_char = invert_shift(char)
        log.debug("convert keycode %s - char %s to %s", event.keycode, repr(char), converted_char)
#         self.text.delete(Tkinter.INSERT + "-1c") # Delete last input char
        self.text.insert(tkinter.INSERT, converted_char) # Insert converted char
        return "break"
376532
def keyReleaseEvent(self, event):
        
        if self.isVisible():
            qsc = get_shortcut(context='Editor', name='Go to next file')

            for key in qsc.split('+'):
                key = key.lower()
                if ((key == 'ctrl' and event.key() == Qt.Key_Control) or
                   (key == 'alt' and event.key() == Qt.Key_Alt)):
                        self.item_selected()
        event.accept()
785875
private function key_create()
    {
        $this->enigma->include_script('openpgp.min.js');

        $this->rc->output->add_handlers(array(
            'keyform' => array($this, 'tpl_key_create_form'),
        ));

        $this->rc->output->set_pagetitle($this->enigma->gettext('keygenerate'));
        $this->rc->output->send('enigma.keycreate');
    }
1134899
function onKeyDown( evt ) {
    switch ( evt.key ) {
    case 'Space':
        this.expanded = !this.expanded;
        evt.preventDefault();
        break;
    case 'Enter':
        this.action = this.value;
        break;
    case 'ArrowDown':
        selectNext.call( this );
        evt.preventDefault();
        break;
    case 'ArrowUp':
        selectPrev.call( this );
        evt.preventDefault();
        break;
    case 'Escape':
        if ( this.expanded ) {
            this.expanded = false;
            // Set the value as it was when we expanded the combo.
            this.value = this._valueWhenExpanded;
            evt.preventDefault();
        }
        break;
    default:
        // Do nothing.
    }
}
120586
function( eventName, keyCode ) {
			// No keyboard, can't simulate...
			if( typeof window.onkeydown === 'undefined' ) return false;
			var oEvent = document.createEvent('KeyboardEvent');

			// Chromium Hack
			if( navigator.userAgent.toLowerCase().indexOf( 'chrome' ) !== -1 ) {
				Object.defineProperty( oEvent, 'keyCode', {
					get: function() { return this.keyCodeVal; }
				});
				Object.defineProperty( oEvent, 'which', {
					get: function() { return this.keyCodeVal; }
				});
			}

			var initKeyEvent = oEvent.initKeyboardEvent || oEvent.initKeyEvent;
			initKeyEvent.call(oEvent,
				'key' + eventName,
				true,
				true,
				document.defaultView,
				false,
				false,
				false,
				false,
				keyCode,
				keyCode
			);

			oEvent.keyCodeVal = keyCode;
		}
1009181
def __onKeyEvent(self, event=None):
        
        if event is None:
            return
        key = event.guiEvent.GetKeyCode()
        if (key < wx.WXK_SPACE or  key > 255):
            return
        ckey = chr(key)
        mod  = event.guiEvent.ControlDown()
        if self.is_macosx:
            mod = event.guiEvent.MetaDown()
        if mod:
            if ckey == 'C':
                self.canvas.Copy_to_Clipboard(event)
            elif ckey == 'S':
                self.save_figure(event)
            elif ckey == 'K':
                self.configure(event)
            elif ckey == 'Z':
                self.unzoom(event)
            elif ckey == 'P':
                self.canvas.printer.Print(event)
603959
def keyPressEvent(self, event):
        
        if event.key() in (Qt.Key_Enter, Qt.Key_Return):
            self.queryEntered.emit(self.query())
        
        super(XOrbQuickFilterWidget, self).keyPressEvent(event)