Signals
Prev | Chapter 3. Basics | Next

## Signals

gtkmm, like most GUI toolkits, is event-driven. When an event occurs, such as the press of a mouse button, the appropriate signal will be emitted by the Widget that was pressed. Each Widget has a different set of signals that it can emit. To make a button click result in an action, we set up a signal handler to catch the button's "clicked" signal.

gtkmm uses the libsigc++ library to implement signals. Here is an example line of code that connects a Gtk::Button's "clicked" signal with a signal handler called "on_button_clicked":

    m_button1.signal_clicked().connect( SigC::slot(*this, &HelloWorld::on_button_clicked) );

For more detailed information about signals, see the appendix.

For information about implementing your own signals rather than just connecting to the existing gtkmm signals, see the appendix.

Prev | Up | Next
Widgets | Home | Glib::ustring