Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It looks like on windows, the scrolledWindow was the right place to watch for scroll events instead of the main window.</p> <p>Using the following modification, I was able to handle scroll events on windows 7.</p> <pre><code>#include &lt;gtkmm.h&gt; #include &lt;iostream&gt; class MyScrolledWindow : public Gtk::ScrolledWindow { public: bool on_scroll_event(GdkEventScroll *e) { std::cout &lt;&lt; "scrollEvent" &lt;&lt; std::endl; return false; } MyScrolledWindow() { } }; class MyWindow : public Gtk::Window { Gtk::EventBox event_box; MyScrolledWindow scrolled; public: bool on_button_press_event(GdkEventButton *b) { std::cout &lt;&lt; "button press" &lt;&lt; std::endl; return false; } MyWindow () { add(scrolled); scrolled.add(event_box); set_default_size(640, 480); show_all(); } }; int main(int argc, char** argv) { Gtk::Main kit(argc, argv); MyWindow window; kit.run(window); return 0; } </code></pre> <p>====== Old Answer: ================</p> <p>I am not able to reproduce your isse. This is the code I used to try to reproduce your issue:</p> <pre><code>#include &lt;gtkmm.h&gt; #include &lt;iostream&gt; class MyEventBox : public Gtk::EventBox { bool on_button_press_event(GdkEventButton *b) { std::cout &lt;&lt; "button press" &lt;&lt; std::endl; return false; } bool on_scroll_event(GdkEventScroll *e) { std::cout &lt;&lt; "scrollEvent" &lt;&lt; std::endl; return false; } }; int main(int argc, char** argv) { Gtk::Main kit(argc, argv); Gtk::Window window; MyEventBox eventBox; eventBox.show(); window.add(eventBox); kit.run(window); return 0; } </code></pre> <p>For compiling, I used the folowing command line (using Linux):</p> <p><code>g++ main.cpp $(pkg-config --cflags --libs gtkmm-3.0)</code></p> <ul> <li>If you can reproduce your issue using this minimum example, the problem might be platform specific and a workaround using the window's/event box' <code>Gdk::Window</code> might be necessary.</li> <li>If you can't reproduce your issue using this code, the issue is caused somewhere else in your code and you'll need to post more information.</li> </ul>
 

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