Note that there are some explanatory texts on larger screens.

plurals
  1. PODetect click on Gtk::Image?
    text
    copied!<p>I've been trying to detect clic on a <code>Gtk::Image</code> with gtkmm for over 2 hours, but I couldn't get it to work. It does compile and excecute fine, but the event is <strong>never</strong> triggered.</p> <p>Some stuff I tried, that compiles, does not crash, but doens't work:</p> <pre><code>m_image = manage(new Gtk::Image(Gtk::Stock::APPLY, Gtk::ICON_SIZE_BUTTON)); m_image-&gt;add_events(Gdk::ALL_EVENTS_MASK); m_hbox-&gt;pack_start(*m_image, Gtk::PACK_SHRINK); m_image-&gt;signal_button_release_event() .connect(sigc::hide(sigc::mem_fun(*this, &amp;Todo::switchStatus))); m_image-&gt;show(); </code></pre> <p>or</p> <pre><code>#include &lt;gtkmm/main.h&gt; #include &lt;gtkmm/window.h&gt; #include &lt;gtkmm/button.h&gt; #include &lt;gtkmm/stock.h&gt; #include &lt;gtkmm/image.h&gt; #include &lt;iostream&gt; using namespace std; class Win : public Gtk::Window { public: Win(); bool link(GdkEventButton* e); private: Gtk::Image image; }; Win::Win() : image(Gtk::Stock::APPLY, Gtk::ICON_SIZE_BUTTON) { cerr &lt;&lt; "created" &lt;&lt; endl; image.add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); image.signal_button_release_event().connect(sigc::mem_fun(*this, &amp;Win::link)); image.show(); add(image); } bool Win::link(GdkEventButton* e) { cerr &lt;&lt; "kuh" &lt;&lt; endl; } int main(int argc, char *argv[]) { Gtk::Main app(argc, argv); Gtk::Window window; window.resize(300, 500); Win win; Gtk::Main::run(win); return 0; } </code></pre> <p>Well, I don't know what else I can dow… Any idea ? :)</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload