Re: Focus on Switching Pages



On Wed, Jan 10, 2001 at 03:02:25PM +0300 Nick Pilon wrote:

I've got a GTK program I'm working on that uses a bunch of notebook pages to
display network connection related stuff. (A MU* client) Each page has a
zvt_term and text entry widget on it. Is there an easy way to focus on the text
entry widget every time the user changes the page?

-- 
-Nick Pilon
--Life is code; Everything else is just preprocessing.


Yes!

void main
{
  ....

  chat_entry = gtk_entry_new();
  notebook = gtk_notebook_new();

  ...........
  gtk_signal_connect (GTK_OBJECT (notebook), "switch_page",
                      GTK_SIGNAL_FUNC (on_notebook_switch_page),
                      chat_entry);
  ...........
}

void
on_notebook_switch_page               (GtkNotebook     *notebook,
                                       GtkNotebookPage *page,
                                       gint             page_num,
                                       gpointer         user_data)
{
  GtkWidget* entry = GTK_WIDGET(user_data);
  gtk_widget_grab_focus(entry);
}


Maybe there is a shorter solution, this is one possible.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]