# Setting focus to child widget on notebook switch-page

**URL:** <https://www.ruby-forum.com/t/setting-focus-to-child-widget-on-notebook-switch-page/183559>\
**Category:** Ruby-Gnome 2\
**Created:** [February 16, 2010, 3:56pm UTC](https://www.ruby-forum.com/t/setting-focus-to-child-widget-on-notebook-switch-page/183559 "2010-02-16T15:56:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjglazer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@sjglazer](https://www.ruby-forum.com/u/sjglazer)\
**Post date:** [February 16, 2010, 3:56pm UTC](https://www.ruby-forum.com/t/setting-focus-to-child-widget-on-notebook-switch-page/183559/1 "2010-02-16T15:56:26Z")

</div>

I have a notebook widget with several pages. The pages each have a few  
child widgets, one of which is a Gtk::Entry. When I switch to a page I  
would like focus to switch to the Gtk::Entry widget. I’ve got a handler  
that is successfully executing on the switch-page signal but I’m not  
sure  
how to get the focus to move to my entry widget so I can start typing  
without having to manually click it. Any help appreciated.

---

<div class="post-metadata">

**Author:** ![sjglazer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@sjglazer](https://www.ruby-forum.com/u/sjglazer)\
**Post date:** [February 16, 2010, 5:09pm UTC](https://www.ruby-forum.com/t/setting-focus-to-child-widget-on-notebook-switch-page/183559/2 "2010-02-16T17:09:01Z")

</div>

2010/2/16 Steve G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I have a notebook widget with several pages.Â The pages each have a few  
> child widgets, one of which is a Gtk::Entry.Â When I switch to a page I  
> would like focus to switch to the Gtk::Entry widget.Â I’ve got a handler  
> that is successfully executing on the switch-page signal but I’m not sure  
> how to get the focus to move to my entry widget so I can start typing  
> without having to manually click it.Â Any help appreciated.

Did you try Gtk::Wigdet#grab\_focus ?

Simon

---

<div class="post-metadata">

**Author:** ![sjglazer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@sjglazer](https://www.ruby-forum.com/u/sjglazer)\
**Post date:** [February 16, 2010, 5:55pm UTC](https://www.ruby-forum.com/t/setting-focus-to-child-widget-on-notebook-switch-page/183559/3 "2010-02-16T17:55:51Z")

</div>

Thanks Simon. That’s what I needed. Sorry for the silly question.

-Steve
