Re: default button




On Dec 19, 2006, at 7:07 AM, beast wrote:

I have this following error, what could be the problem?

Gtk-WARNING **: gtkwidget.c:4007: widget not within a GtkWindow at
./setup.pl line 255.

--
      $next->set_flags('can-default');
      $next->grab_default();
--

You're calling grab_default() on $next before $next has been packed into the widget tree.

I want the next button to be the default action (having the keyboard
focus). What is the correct flag, grab_focus or grab_default?
Thanks.

grab_default() is fine, but the widget must first be packed into a container such that it has a toplevel window. The implementation of gtk_widget_grab_default() is essentially

       $widget->get_toplevel()->set_default ($widget);

This is because all key events actually get handled by the toplevel window, and the toplevel window has to know which child widget to activate when the user activates the default.



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