Re: connect_notify weirdness, once again...

Vladislav Grinchenko wrote:
On Sun, 2005-04-10 at 12:35, Matthias Kaeppler wrote:

Is this also the case for the signal_button_press_event?
Because I am connecting (not connect_notify'ing) a signal handler which returns a boolean to that signal, and it is never called. OTOH, this signal handler (handling mouse button presses) doesn't sound to be "rare":

class MyWidget: public Gtk::ScrolledWindow
    bool on_button_press_event( GdkEventButton* );
// ...
    Gtk::TreeView view_;
// ...

// ...
view_.signal_button_press_event().connect( sigc::mem_fun( *this, &MyWidget::on_button_press_event ) );

The signal handler is never called. I have to declare it void and connect with connect_notify().
I still don't get the point.

PS: Can you also reply to my other post regarding signal handlers in general, i.e. when signal_button_press_event is fired if I have an overlapping view and a widget, which both can fire this event.

Thanks in advance.

in your c'tor try this:

add_events (Gdk::BUTTON_PRESS_MASK);

	/** 'false' argument tells Gtk+ to call on_key_pressed() BEFORE
		keypress event handling. Returning 'true' from
                on_key_pressed() will stop event processing.
signal_key_press_event ().connect(
	sigc::mem_fun (*this, &MyWidget::on_key_pressed), false);

And in general, is this the way to go, or is it fine as well to just handle the signals emitted from the view? What I meant is that th TreeView takes the whole visible area of my ScrolledWindow, so when I click in it, do both fire an event? And if so, which one to handle?

Matthias Kaeppler

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