Re: [gtkmm] TreeView widget - Double-Click



OK,
I have written a little "HelloWorld" program with
signal_button_press_event().
Here is the source:
But if press the button, nothing happens! What's wrong?

#include <gtkmm.h>
#include <iostream>

using namespace std;

class HelloWorld : public Gtk::Window
{
public:
        HelloWorld();

    protected:
        Gtk::Button m_button;

    bool on_button_press(GdkEventButton *event)
        {
            cout << "pressed" << endl;
        }
};

HelloWorld::HelloWorld()
: m_button("Hello World")
{
    add(m_button);
    m_button.show();
    m_button.signal_button_press_event().connect(SigC::slot(*this,
&HelloWorld::on_button_press));
}

int main (int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);

    HelloWorld helloworld;
    Gtk::Main::run(helloworld);

    return 0;
}





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]