# Change widget focus with enter instead of tab

**URL:** <https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125>\
**Category:** wxRuby\
**Created:** [September 17, 2010, 9:55am UTC](https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125 "2010-09-17T09:55:50Z")\
**Posts on this page:** 5\
**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:** [September 17, 2010, 9:55am UTC](https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125/1 "2010-09-17T09:55:50Z")

</div>

Dear all,

is there a way to change widget focus with enter key instead of tab

Regards  
Hendra

---

<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:** [September 17, 2010, 11:38am UTC](https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125/2 "2010-09-17T11:38:51Z")

</div>

Set style to text filed that should receive enter event:

text\_fied\_1.toggle\_window\_style(Wx::TE\_PROCESS\_ENTER)

into the panel that contain text\_field\_1

evt\_text\_enter(text\_field\_a) { |evt| text\_field\_2.set\_focus()}

hope this help.

regards,

bio.

---

<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:** [September 18, 2010, 3:54am UTC](https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125/3 "2010-09-18T03:54:08Z")

</div>

very helpful  
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:** [September 19, 2010, 7:21pm UTC](https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125/4 "2010-09-19T19:21:26Z")

</div>

Fabio P. wrote:

> Set style to text filed that should receive enter event:
> 
> text\_fied\_1.toggle\_window\_style(Wx::TE\_PROCESS\_ENTER)  
> into the panel that contain text\_field\_1  
> evt\_text\_enter(text\_field\_a) { |evt| text\_field\_2.set\_focus()}
> 
> hope this help.
> 
> regards,
> 
> bio.

is this possible for grid cell editors, too?

Thanks,  
Tony

---

<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:** [September 20, 2010, 9:30am UTC](https://www.ruby-forum.com/t/change-widget-focus-with-enter-instead-of-tab/195125/5 "2010-09-20T09:30:11Z")

</div>

On Sun, Sep 19, 2010 at 7:21 PM, Tony M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > bio.
> 
> is this possible for grid cell editors, too?
> 
> ## Thanks, Tony

I don’t really know…

You think should check for something like ‘activate’ event and then, if  
you  
can localize cell grid objects and they respond to ‘set\_focus’, it  
should  
work.

Let us know.

Good luck.

bio.
