By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,417 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

No keydown event fires in a datagrid

P: n/a
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydown event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I believe you have that problem because when you run your program the focus
is not on your data grid (explayning why when you click on it it will process
the messages). You should try placing focus on the data grid when your form
is created.

"bardo" wrote:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydown event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo

Nov 16 '05 #2

P: n/a
I tested the focus (using the focus enter and leave events) but the focus is
not the problem. I click on the Datagrid. Then in the datagrid I use the
arrow keys to move up and down thru the records, but no keydown event is
fired. The only way I can get the key events to fire is when I click with the
mouse on a record (row) and make it blue. Now I click on it again and now I
get the keydown event. Seems there are 2 focusses in the datagrid. But I find
this strange.

I will try some other tests and see what happens.

"Aleksandar Mraović" wrote:
I believe you have that problem because when you run your program the focus
is not on your data grid (explayning why when you click on it it will process
the messages). You should try placing focus on the data grid when your form
is created.

"bardo" wrote:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydown event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo

Nov 16 '05 #3

P: n/a
Short update:

Using the processCmdkey I found out that when you use the arrow keys to
navigate thru the rows ,the datgrid loses focus. But the datagrid.focusleave
event will not fire. I don't know if this is done on purpose or is maybe a
design flaw.

"bardo" wrote:
I tested the focus (using the focus enter and leave events) but the focus is
not the problem. I click on the Datagrid. Then in the datagrid I use the
arrow keys to move up and down thru the records, but no keydown event is
fired. The only way I can get the key events to fire is when I click with the
mouse on a record (row) and make it blue. Now I click on it again and now I
get the keydown event. Seems there are 2 focusses in the datagrid. But I find
this strange.

I will try some other tests and see what happens.

"Aleksandar Mraović" wrote:
I believe you have that problem because when you run your program the focus
is not on your data grid (explayning why when you click on it it will process
the messages). You should try placing focus on the data grid when your form
is created.

"bardo" wrote:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I click on a row (withs will turn
blue then) and then click on it again . Now if I press any key the event will
fire (except for the arrow keys).

I also tried to override the IsInputKey => no luck.
I also tried to override the ProcessCmdKey => With this I can atleast
capture the arrow keys but I still can't get the datagrid.keydown event to
fire unless I call the event in de ProcessCmdKey but I don't think this is
the way to do it.

Does anyone know why the keydown event won't fire in a datagrid ?

Bardo

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.