Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-connection signals with GtkBuilder but on GTKmm

Tags:

c++

c

gtk

gtkmm

In C, I can autoconnect signals with this code:

gtk_builder_connect_signals (builder, NULL)

How to do this in C++ with GTKmm?

like image 340
drmgc Avatar asked Dec 14 '13 14:12

drmgc


1 Answers

You cannot use Glade to connect your signals when using gtkmm, you need to do that manually.

    Glib::RefPtr builder = Gtk::Builder::create_from_file("glade_file.ui");

    Gtk::Window *window1 = 0;
    builder->get_widget("window1", window1);

    Gtk::Button *button1 = 0;
    builder->get_widget("button1", button1);
    // get other widgets
    ...

    button1->signal_clicked().connect(sigc::mem_fun(*this, &button1_clicked));

Have a look at these answers :

https://stackoverflow.com/a/3191472/1673000

https://stackoverflow.com/a/1637058/1673000

like image 68
Manmohan Bishnoi Avatar answered Sep 25 '22 13:09

Manmohan Bishnoi