469,156 Members | 2,168 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,156 developers. It's quick & easy.

No keydown event fires in a datagrid

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
3 8895
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
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
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.

Similar topics

reply views Thread by CoderOfBugs | last post: by
8 posts views Thread by Peter Proost | last post: by
2 posts views Thread by blue_nirvana | last post: by
14 posts views Thread by Brett Romero | last post: by
reply views Thread by arlie_maija | last post: by
5 posts views Thread by ApexData | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.