Re: [gtkmm] label en button_press_event problems



Am 09.10.2003 um 21:29 Uhr haben Sie geschrieben:
> Ok, i am trying to connect an signal_button_press_event to a
Gtk::Label.
> I use the following code:
> 
> testlabel.signal_button_press_event().connect( SigC::slot(
> &PresenceWindow::on_button_press_event )  );

You need to pass a PresenceWindow object into SigC::slot().

testlabel.signal_button_press_event().connect( SigC::slot(
my_window, &PresenceWindow::on_button_press_event )  );

should work if my_window is of type PresenceWindow.

BUT, you must not connect on_button_press_event() to
signal_button_press_event() or you risk entering an endless loop!
on_button_press_event() is a virtual function that you seem to override
correctly and that is triggered automatically if you call
add_events(Gdk::BUTTON_PRESS) from your PresenceWindow constructor.

Regards,

  Martin







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