| Not receiving the "Enter" keycode in form.keydown event |
|
Hi Goal: I have a child-form with several container controls: 2 panels, 4 buttons and 1 groupbox. All these have child controls. One of the panels' child controls consists of dynamically created "PictureBox"es. When a certain action is triggered "Move" the picture boxes should be moved using the keyboard "Left" and "Right" keys. Pressing "Enter" should end the "move". Problem: I have sucessfully achieved this , by creating a new project - "Test". The test project has a "Panel", that loads the pictureboxes dynamically. It also has 4 buttons and a label, that I use for sending debug messages. When I use the arrow keys in the "Test" project I am able to move the picturebox : pressing "Enter" ends the move. I have achieved this as follows: 1. Set the Parent Form.KeyPreview = True 2. Use a Form1_KeyDown event. In that event I check for the following: Select Case e.KeyCode Case Keys.Left .......... Case Keys.Right .......... Case Keys.Enter .......... All of this works perfectly in the "Test" project. The arrow keys work perfectly in the "real" project, but when I press "Enter" it is not captured. I HAVE NO IDEA WHAT IS GOING ON. Any help is appreaciated. Thanks in advance!
|

KeyDown not receiving "Enter" key event
Javier Canones
To detect an esc character & write code for it in 1 place, would one have to do all that enabled=false etc.
Does this imply that if you need controls enabled on a form, you'd have to catch the esc character at KeyDown events for all enabled controls
Inkyskin_UK
Shiku...
You are aware that these events depend upon what control has focus at the time
Adam_W
LondonSte
I am sorry! I should have mentioned that I have "enabled='False'" for all the controls and set all the "tabindex=0" for all controls. Thanks,
Shiku
david.r.johnson
Hi All, I have accidentally found out the reason for the problem:
THERE WAS NO control capable of receiving input. After posting the query I was asked to add a text box and once that textbox received focus all is well. Thank you all for your time.