GtkComboBoxText with GtkEntry

I have a GtkComboBoxText widget in GTK4 that has the “has-entry” property.
When, the user selects from the drop-down, the selection appears in the GtkEntry as I would expect, but the text is ‘selected’.
Can this be disabled or can I de-select the text in response to a signal? I tried doing this on the GtkEditable widget when the change signal of the GtkComboBoxText occurs but this did not work.

Michael

combo

Hi,

If you manually focus the entry on response of a signal, you can use Gtk.Entry.grab_focus_without_selecting to avoid selecting.

If you don’t control who/when the focus is requested, try to connect on notify::has-focus signal, and call Gtk.Editable.select_region (0, 0) from the callback.

I was using gtk_editable_select_region( GTK_EDITABLE(wNSentry), -1, -1); in response to the changed signal of the GtkComboBoxText but this didn’t work.

After a bit of Googling, I found a post that implied I needed to first focus on the GtkEntry widget component of the GtkComboBoxText. So, preceding the call with gtk_widget_grab_focus( GTK_WIDGET( wNSentry )); did result in the deselection as I wanted.

It is not intuitive to me that it needs to have focus to select/deselect.

Michael

P.S. looks like docs.gtk.org is down again … (I need to get a local copy of the docs!)