keyboard-events

jQuery accommodating both HOVER and FOCUS together (mouse and keyboard)

爷,独闯天下 提交于 2019-12-07 22:10:41
问题 I'm building a mega menu where I want to be able to trigger the menu via both a hover (using the mouse) and focus (such as tabbing to it via the keyboard). This is what I'm presently doing: $(".megaMenu-trigger").focus(function (){$(this).hover()}); $(".megaMenu-trigger").hover(function(){ // do the stuff }); This works, but am wondering if that's the ideal way to handle both keyboard and mouse interactions together. 回答1: you can use the bind method to bind multiple events to one action i.e.

C++ Console app, SetWindowsHookEx, Callback is never called

橙三吉。 提交于 2019-12-07 11:43:41
问题 I have a little console application that has an embedded v8 engine, and I would like to add a hook to register key events. This all worked before when I was using Qt and QtScript, but I am porting it all over to straight C++ in VC++ 2008. The application compiles and runs, but the hook is never called, here is the relevant code: In main() HWND hwndC = GetConsoleWindow() ; HINSTANCE hInst = (HINSTANCE)GetWindowLong( hwndC, GWL_HINSTANCE ); if (SetWindowsHookEx(WH_KEYBOARD_LL, HookProc, hInst,

SendInput() and non-English characters and keyboard layouts

天涯浪子 提交于 2019-12-07 09:23:21
问题 I'm having trouble simulating character keypresses when a non-English input keyboard language is being used in Windows. I tried calling SendInput() with KEYEVENTF_UNICODE: KEYBDINPUT ki; INPUT input; int character = 0; ki.wVk = 0; ki.wScan = character; ki.dwFlags = KEYEVENTF_UNICODE; ki.time = 0; ki.dwExtraInfo = 0; input.type = INPUT_KEYBOARD; input.ki = ki; SendInput(1, &input, sizeof(INPUT)); And this actually works (of course, in my code, I also do a KEYUP after the key down)... except in

How to hook IE keyboard event?

假装没事ソ 提交于 2019-12-07 08:02:20
问题 I am trying to disable browser shortcuts while user tries to press some combination of keys on the swf file. Although I can achieve this in Firefox, below code does not function in IE 8. Below code is able to hook the keyboard events if focus is not on the swf file. However, what I need is hooking keyboard events when user operates on swf file. function hookKeyboardEvents(e) { alert("hooked key"); // get key code var key_code = (window.event) ? event.keyCode : e.which; // case :if it is IE

How to receive keyboard events for a NSView after exiting fullscreen mode?

我怕爱的太早我们不能终老 提交于 2019-12-07 06:11:07
问题 I subclass an NSView and start full screen mode when the application finished launching. The view is available as the property fooView in the application delegate. // AppDelegate.m - (void)applicationDidFinishLaunching:(NSNotification*)notification { [[self window] makeKeyAndOrderFront:self]; [[self fooView] enterFullScreenMode:[NSScreen mainScreen] withOptions:nil]; } The class FooView itself implements the following functions. // FooView.m - (void)keyDown:(NSEvent*)event { NSLog(@"%@ %@ - %

windows phone 8.1 swype keyboard event capture

不打扰是莪最后的温柔 提交于 2019-12-07 02:50:44
问题 Update [16-Jul-2014]: The question is technically incorrect. Read the answer to get more details. I was trying to capture text before reaching to my text box. and I discovered the following facts: KeyDown , KeyUp event will tell you what virtualKey was pressed not the character !! CoreWindow.CharacterReceived will capture the character but this event is not specific to TextBox and it will tell you the character after it reached to the textBox. Now my question is: Can any one tell me how can I

javascript alt key

末鹿安然 提交于 2019-12-06 20:25:10
问题 We are creating a web user interface that looks like a desktop window. Now we need to handle the Alt key. When Alt key is pressed the focus goes to the upper menu. In Javascript, how to get the event for Alt key when ONLY Alt key is pressed? I need to ensure that no other key was pressed at the same time. Thanks in advance. 回答1: maybe like this document.onkeydown = keydown; function keydown(evt) { if (!evt) evt = event; if (evt.altKey) { alert('alt'); } } // function keydown(evt)​ 回答2:

Check if a Key is Down with Qt

╄→гoц情女王★ 提交于 2019-12-06 19:37:10
问题 I am playing around with some graphics, and I have implemented simple camera movement with the arrow keys. My first approach was to override keyPressEvent to do something like this: switch(key) { case up: MoveCameraForward(step); break; case left: MoveCameraLeft(step); break; ... } This doesn't work as I wish it would. When I press and hold, for example, the forward key, the camera moves forward "step" units, then halts for a while and then continues moving. I am guessing that this is how the

CGEventPost - hold a key (shift)

为君一笑 提交于 2019-12-06 19:34:47
问题 I'm looking for a way to design a little panel with modifier keys on it (shift, command for example) and have to possibility to click on it like a virtual keyboard. I'd like it to have this behavior : click on the virtual key (shift). the shift button holds, and keeps being pressed. type something with my standard keyboard. click another time on the virtual shift key to release it. here is the code I'm using : CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);

Physical Key State

家住魔仙堡 提交于 2019-12-06 15:51:51
问题 The two key-state functions in the WIndows API, GetKeyState() and GetAsyncKeyState() , both determine key state based on key up/down messages rather than the physical state of the key. I am working on a program which manipulates input, using SendInput() , to release modifier keys (alt, ctrl, etc...), send input, and then re-press the modifier keys. The problem is that I don't know if the modifier keys are still pressed after the input is sent because I have sent the key-up event and both of