Has default vs. receives default

There are several checkboxes in Glade which I’m not clear on. What is “Has default” or “Receives default”, “Has focus” or “Is focus”?

How do I setup which control actually gets the focus by default in Glade? For example using a popup window. How do I set these flags so that the keyboard focus starts in a specific edit field and when I press return, it triggers a specific button?

1 Like

In Glade, right click on any of the properties in the right panel, then Read documentation.

Compare the following functions:

https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-default
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-can-default
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-has-default
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-receives-default

And for focus:

https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-grab-focus
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-can-focus
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-has-focus

For the edit control:

  • In the Common properties panel, select all the three checkboxes ‘Can focus’, ‘Has focus’ and ‘Is focus’
  • In the General properties panel, select the ‘Activates default’ checkbox.

For the button control:

  • In the Common properties panel, select the two checkboxes ‘Can default’ and ‘Has default’

Hope it helps!

Thanks for your help but the documentation is not much clearer than the button names. For example, receives default is defined as “the widget will receive the default action when it is focused”, where has default is defined “the widget is the default widget”. Why would the widget that is default not receive the default action? If the widget is not the widget that has default when it receives default, what happens to the other default? Does the widget that has default also receive default? What happens if more than one widget has default?

However, the documentation has made things a little clearer. I will follow those directions. I wasn’t aware of the activates default setting at all. I guess that explains why it didn’t seem to be working.

Thanks for you help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.