Re: "widget_class->event" not working



On 08/20/2009 10:27 PM, Patrick M. Rutkowski wrote:
I've written a test case that anybody can compile and run:
http://www.rutski89.com/static/event_test.c

It contains the following line of code in the any_event() function:
printf("IT WORKS!\n");

That currently does not get printed.

If you can get the test case to print that line of text, you will have
solved my problem.

I can, but probably not in the way you want.  I think one of two things
is going on:

1.  GtkWidget just doesn't handle events and subclassing it will take
more work than just subclassing realize() to get it to receive events.

2.  You're missing something in your realize() method, though I'm not
sure what.

If I make your Foo class into a subclass of GtkEventBox instead of
GtkWidget, and then remove your realize() implementation (so it uses
GtkEventBox's impl), then it prints "IT WORKS!" as you'd expect.
Perhaps perusing gtkeventbox.c might help you figure out what else is
needed if you really want to just subclass GtkWidget.

        -brian



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