Re: Button Press / Release Events on a HScale



Quoting Lyle Underwood <lyleunderwood gmail com>:

> Thanks again smso,
> 
> But I've been testing and testing this and as far as I can tell setting
> after = false as the second param of the connect function changes
> nothing in this situation. I can't see any affect at all. Updated test
> source is attached. Here are some pertinent bits:
> 
> m_EventBox.signal_button_press_event().connect(
>   sigc::mem_fun(*this, &ExampleWindow::on_eventbox_button_press), 
>   false 
> );
> 
> bool ExampleWindow::on_eventbox_button_press(GdkEventButton* event)
> {
>   std::cout << "pressed" << std::endl;
>   // "If the value is false then gtkmm will pass the event on to the 
>   // next signal handler."
>  
>
//http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-xeventsignals.html.en
>   return false;
> }
> 
> I tried all my different combinations again and everything seemed to be
> the same to me. Any further help would be greatly appreciated. I would
> love for somebody to tell me I'm doing something else wrong!
> 
> Thanks again,
> Lyle
> 
Dear Lyle,
    What I actually mean is that the use of event box is not necessary in this
case. You can just connect to the button press event of m_Scale (Gtk::HScale)
as in:

m_Scale.signal_button_press_event().connect(
  sigc::mem_fun(*this, &ExampleWindow::on_eventbox_button_press), 
  false 
);

    On the other hand, if you really want to detect event of event box, do
this:
//m_EventBox.add_events(Gdk::ALL_EVENTS_MASK);
/***/
	m_EventBox.add_events
	(
		Gdk::EXPOSURE_MASK
		| Gdk::POINTER_MOTION_MASK
		| Gdk::BUTTON_PRESS_MASK
		| Gdk::BUTTON_RELEASE_MASK
		| Gdk::BUTTON_MOTION_MASK
		| Gdk::POINTER_MOTION_HINT_MASK
		| Gdk::ENTER_NOTIFY_MASK
		| Gdk::LEAVE_NOTIFY_MASK
		| Gdk::FOCUS_CHANGE_MASK
		| Gdk::SCROLL_MASK
		| Gdk::KEY_PRESS_MASK
	);
Regards from smso





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