problem with signal_configure_event
- From: "Jonathon Jongsma" <jonathon jongsma gmail com>
- To: "Gtkmm Mailing List" <gtkmm-list gnome org>
- Subject: problem with signal_configure_event
- Date: Sun, 3 Dec 2006 20:21:45 -0600
I seem to be having some issues getting the configure-event handler to
fire. If I connect a regular GTK+ signal handler, it works fine, and
if I derive from the Window class and implement the virtual
on_configure_event() function, it also works fine. But it doesn't
work if I use the normal connect() method. Interestingly, it works if
I use connect_notify(), however. Can anybody explain this? Is it a
bug? user error? or is this expected behavior?
example follows:
---------------------------
#include <iostream>
#include <gtkmm.h>
bool
on_c_configure(GdkEventConfigure* event, void* data)
{
std::cout << "GTK+ handler -- this works" << std::endl;
return true;
}
bool
on_configure(GdkEventConfigure* event)
{
std::cout << "gtkmm handler connect() -- ***this doesnt work***"
<< std::endl;
return true;
}
void
on_configure_notify(GdkEventConfigure* event)
{
std::cout << "gtkmm handler connect_notify() -- this works" << std::endl;
}
class ConfigureWindow : public Gtk::Window
{
public:
ConfigureWindow() : Gtk::Window() {}
virtual bool on_configure_event(GdkEventConfigure* event)
{
std::cout << "virtual gtkmm handler -- this works" << std::endl;
return true;
}
};
int
main(int argc, char** argv)
{
Gtk::Main app(argc, argv);
Gtk::Window win;
win.signal_configure_event().connect(sigc::ptr_fun(&on_configure));
win.signal_configure_event().connect_notify(sigc::ptr_fun(&on_configure_notify));
g_signal_connect(win.gobj(), "configure-event",
G_CALLBACK(on_c_configure), NULL);
app.run(win);
/* or:
ConfigureWindow win2;
app.run(win2);
*/
return 0;
}
--
jonner
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]