Search code examples
c++linuxgtkgtk3gtkmm

How to use Gtk::EntryCompletion::set_match_func on GTKMM C++?


i want to search something for every sub string. I've been looking for GTK completion example on internet but i couldn't find the example with set_match_func. The documentation says i need to specify SlotMatch, but I don't understand how to use SlotMatch.

  m_completion->set_text_column(0);
  m_completion->set_minimum_key_length(0);
  m_completion->set_popup_completion(true);
  m_completion->set_match_func(func);

Solution

  • The first line in the documentation, right after the inheritance diagram

    typedef sigc::slot< bool(const Glib::ustring&, const TreeModel::const_iterator&)>   SlotMatch;
    

    Further reading reaches the example

    For example, bool on_match(const Glib::ustring& key, const TreeModel::const_iterator& iter);

    In gtkmm

    m_completion->set_match_func(sigc::ptr_fun(on_match));