keydown

How use the combobox keydown event without selecting the listed item

喜你入骨 提交于 2019-12-17 19:56:07
问题 I have in my Excel VBA project, a combobox which uses a range of cells as it's list of items. I have used a filter in it, so that whenever a value is entered, the list shrinks down to the items containing the string, and dropdown list is shown. However, the problem appears, when the dropdown is shown, the navigation keys can't be used to scroll within the items. As soon as the down key is pressed the dropdown list will be filtered again. I guess its happening because the down key while

Cross-browser way to get automatically repeating keydown events when key is held down

你说的曾经没有我的故事 提交于 2019-12-17 19:52:54
问题 Using Javascript / jQuery, how can I get automatically repeating keydown events, or equivalent, when someone holds down a key? What I actually want is to be able to check whether a key is down, but from other questions here it looks like that's not possible. The suggested workaround seems to be recording keydown and keyup events and then assuming the key is down if a keydown event has been recorded and no subsequent keyup. That solution runs into a problem in my case. I am designing an online

KeyboardEvent in Chrome, keyCode is 0

戏子无情 提交于 2019-12-17 15:53:49
问题 I am trying to set keyCode on dispatched event object . On button click, event is raised on textbox control to simulating keydown event. Event is raised successfully, but keyCode is 0. I need to send event object with correct keyCode to textbox. I've been using code from here. How to set keyCode value in dispatched event? <html> <head> </head> <body> <input type="button" id="btn" value="Click"></input> <input type="text" id="txt"></input> <script> document.getElementById('btn')

C# trying to capture the KeyDown event on a form

前提是你 提交于 2019-12-17 10:59:17
问题 I am creating a small game, the game is printed onto a panel on a windows form. Now i want to capture the keydown event to see if its the arrow keys that has been pressed, the problem however is that i can't seem to capture it. Let me explain, on the form i have 4 buttons and various other controls and if the user for instance press one of the buttons (to trigger a game event) then the button has focus and i can't capture the movements with the arrow keys. I tried something like private void

KeyDown : recognizing multiple keys

浪尽此生 提交于 2019-12-17 10:47:35
问题 How can I determine in KeyDown that Ctrl Up was pressed. private void listView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Control && e.KeyCode == Keys.Up) { //do stuff } } can't work, because never both keys are pressed exactly in the same second. You always to at first the Ctrl and then the other one... 回答1: You can check the modifiers of the KeyEventArgs like so: private void listView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up && e.Modifiers ==

How do I capture Keys.F1 regardless of the focused control on a form?

社会主义新天地 提交于 2019-12-17 07:29:17
问题 I used KeyDown event and some simple code like if (e.KeyCode == Keys.F1) to capture F1 is pressed on a form BUT if there are some text boxes on the form or if there are some spreadsheets with Dock Fill on the form then the code above gets useless and does nothing. But I want to do something when user presses F1 on this form. so how do we capture a specific keydown event like F1 on the whole form..and I do not want to go to the route that capture the KeyDown of all other controls on the form

How do I capture Keys.F1 regardless of the focused control on a form?

爷,独闯天下 提交于 2019-12-17 07:26:11
问题 I used KeyDown event and some simple code like if (e.KeyCode == Keys.F1) to capture F1 is pressed on a form BUT if there are some text boxes on the form or if there are some spreadsheets with Dock Fill on the form then the code above gets useless and does nothing. But I want to do something when user presses F1 on this form. so how do we capture a specific keydown event like F1 on the whole form..and I do not want to go to the route that capture the KeyDown of all other controls on the form

DataGridView keydown event not working in C#

夙愿已清 提交于 2019-12-17 06:09:25
问题 DataGridView keydown event is not working when I am editing text inside a cell. I am assigning shortcut Alt+S to save the data, it works when cell is not in edit mode, but if it is in edit mode below code is not working private void dataGridView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == (Keys.Alt | Keys.S)) { //save data } } 回答1: Whenever a cell is in edit mode, its hosted control is receiving the KeyDown event instead of the parent DataGridView that contains it. That's why

Python method for reading keypress?

对着背影说爱祢 提交于 2019-12-17 03:07:45
问题 I'm new to Python, and I just made a game and a menu in Python. Question is, that using (raw_)input() requires me to press enter after every keypress, I'd like to make it so that pressing down-arrow will instantly select the next menu item, or move down in the game. At the moment, it requires me to like type "down" and then hit enter. I also did quite a lot of research, but I would prefer not to download huge modules (e.g. pygame) just to achieve a single keyDown() method. So are there any

How can I respond to a keyboard chord and replace the entered alpha key with a special one?

僤鯓⒐⒋嵵緔 提交于 2019-12-13 23:07:24
问题 I want to, in a textbox on a WinForms app using C#, replace certain keyboard chords with special characters. For example, if the user enters "Ctrl+A", I want to insert into the textbox the character "á"; if the user enters "Ctrl+Shift+A", I want to insert into the textbox the character "Á", etc. Based on what I found here, I started off with this: private void textBox_KeyDown(object sender, KeyEventArgs keArgs) { bool useHTMLCodes = checkBoxUseHTMLCodes.Checked; String replacement = null; if