Gtk3 gtkmm combobox notify::popup problem

Hello

I have problem with Combobox. I need to catch signal when Combobox expand popup menu and i achieve this in pure C with GTK+ 3.24 and code below:

g_signal_connect(cbPortTest, "notify::popup-shown", G_CALLBACK (signal_cbPortTest), NULL);

void signal_cbPortTest(GtkWidget* widget, GParamSpec* property, gpointer data)
{
	bool value;

	g_object_get(G_OBJECT(widget),"popup-shown", &value,NULL);
	if(value)
	{
		g_print ("Hello World cbPortTest \n");
	}
}

But i have to problem to make it work with gtkmm. I try something like this:
in class constructor:

m_cbPortTest->add_events(Gdk::PROPERTY_CHANGE_MASK);
m_cbPortTest->signal_property_notify_event().connect(sigc::mem_fun(*this, &appWindow::onPortTestNotify), false);

and class method:

bool appWindow::onPortTestNotify(GdkEventProperty* property_event)
{
	g_print ("Hello World\n");
	return true;
}

In gtkmm callback is not working. It is possible to make it working?

maybe:

m_cbPortTest->property_popup_shown()
    .signal_changed()
    .connect( sigc::mem_fun(*this, &appWindow::onComboPopShown));

look this example: examples/properties/properties_example.cc · master · GNOME / glibmm · GitLab

1 Like

Great. Now everything works! Thank You!

1 Like

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