Hi List, TL; DR: See attached source code. button_press refuses to fire on EventBox parent of HScale when clicking on trough or slider, but double-clicking fires one button_press. I'm trying to connect to the button press event of an HScale. I quickly found that this did not work. So I tried using an EventBox, and that did not work either. The EventBox is under the Scale, so the events don't fire if you click on the trough or the slider of the scale unless you do set_above_child(true), but then the EventBox actually STOPS the events, and they don't filter down to the child at all, so it's impossible to activate the scale by clicking on it. I tried tons of variations of set_above_child and set_visible_window, I added the event masks to BOTH the EventBox and the HScale under it, I connected to the button_press events of BOTH of them... Something interesting that I noticed though: If I double-click, it registers one click event from under the Scale. It never sees any release events though. So the workaround that I came to was that I would do set_above_child(true), and in my button_pressed handler I would do scale->event((GdkEvent*)pressEvent) to send button_press on to the scale from the EventBox. This worked. I then thought that I could just connect to signal_event of the EventBox and pass all the signals. This did not work. Even when I tried to connect to button_release of the event box and pass that to the Scale via event(releaseEvent), it did not get the event. And yes, my masks were set to receive release events. I have no idea why this did not work for button_release but it did for button_press. Maybe the underlying Scale is focused in a way that keeps the EventBox from getting the button_release? In any case, I ended up connecting to the signal_event of the EventBox and just doing if(event->type == 10), which is enter_notify, and used that as my release event. This is obviously a terrible hack that will break all the time, but I don't know what else to do. Am I stupid here? I was wrestling with this for hours. Is this a bug somewhere? I'm attaching my test code, modified from the gtkmm book. By compiling it you will see button_press events not firing on the EventBox. You should be able to get them to fire by double-clicking on the trough or slider, but not by single-clicking. There are also some-commented out lines that illustrate the other problems I ran into (examplewindow.cc). Let me know if there's any more information I can give to illustrate this problem. Thanks for any insight, Lyle
Attachment:
eventbox-scale.tar.gz
Description: application/compressed-tar