c++ - Connect to Gtk::Window signal_delete_event -
i want connect signal window.signal_delete_event, fails following error messages:
- no match call ‘(sigc::bound_mem_functor0) (_gdkeventany* const&)’ opticalinput
- return-statement value, in function returning 'void' [-fpermissive]
- void value not ignored ought be
that code line causing error:
window.signal_delete_event().connect(sigc::mem_fun(this,&guiwindow::onexitclicked));
the pointed member function one:
void guiwindow::onexitclicked() { *state = false; gtk::main::quit(); }
any ideas on how fix this?
your method must match signature of signal. in gtkmm documentation signal_delete_event()
, following prototype given:
bool on_my_delete_event(gdkeventany* event)
using naming, method must defined follows:
bool guiwindow::onexitclicked(gdkeventany* event) { ... }
the return value used indicate whether or not have handled event. if return true, other handlers event not see it.