How to retrieve GTK::entry value

I have a Gtk::ListStore filled with row data.

I want the user to be able to type the row data they want to select so I am using aGtk::Entry

I have found a code sample to implement this here

  // Configure the Completion
  m_refEntryCompletion = Gtk::EntryCompletion::create();
  m_refCompletionModel = Gtk::ListStore::create(m_completionRecord);

  m_refEntryCompletion->set_text_column (m_completionRecord.col_text);


I want to extract the check that the user has entered into the Gtk::Entry field

Example here Solvakia is one of the country in the list.
When user has completed selection.

  1. How do I come to know when the user has completed selection?
  2. How do I extract the Completed Entry so that I highlight in the list?

Maybe I don’t understand it fully, but why not use Gtk.SearchEntry? :thinking:

If “the user has completed selection” means “the user has pressed Enter”,
you can use Gtk::Entry::signal_activate(). If you use gtkmm4, that signal is
available only since gtkmm 4.7.1. If you use gtkmm 4.0.0-4.7.0, I have no good answer.

You can then get the selected text, but I don’t know an easy way to find that
text in the Gtk::ListStore.

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