# How to read keypress in grid

**URL:** <https://www.ruby-forum.com/t/how-to-read-keypress-in-grid/171359>\
**Category:** wxRuby\
**Created:** [July 1, 2009, 5:17am UTC](https://www.ruby-forum.com/t/how-to-read-keypress-in-grid/171359 "2009-07-01T05:17:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [July 1, 2009, 5:17am UTC](https://www.ruby-forum.com/t/how-to-read-keypress-in-grid/171359/1 "2009-07-01T05:17:58Z")

</div>

Hi there

I have a form with a grid displaying all data below it  
I want to be able to navigate around the grid (grid is readonly),  
then when I press enter  
data of current row will be put on the form

how to do that?

thank you

---

<div class="post-metadata">

**Author:** ![hendra\_kusuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/5f8ce5/32.png) [@hendra\_kusuma](https://www.ruby-forum.com/u/hendra_kusuma)\
**Post date:** [July 1, 2009, 6:12am UTC](https://www.ruby-forum.com/t/how-to-read-keypress-in-grid/171359/2 "2009-07-01T06:12:21Z")

</div>

I believe the event handler that you require, is  
evt\_grid\_cell\_left\_click()  
and evt\_grid\_label\_left\_click() are the events that you want to catch,  
and  
they give an GridEvent instance, where you can use get\_row() to get the  
row  
on the instance of the GridEvent. The documentation doesn’t have a link  
to  
the GridEvent class, but the documentation is there, you can find it  
here:  
[http://wxruby.rubyforge.org/doc/gridevent.html](http://wxruby.rubyforge.org/doc/gridevent.html)

hth,

Mario
