Re: force drawing area expose on button click



Ok, I tried doing that before. It doesn't work. I get a runtime error. Apparently the pointers act funny and the functions doesn't believe that it's actually a Widget. (oglbb:7399): Gtk-CRITICAL **: file gtkwidget.c: line 2176 (gtk_widget_queue_draw): assertion `GTK_IS_WIDGET (widget)' failed

That is the exact error I get when using the sample code you provided. I tried poking it and changing a few things, but I either get that error or a segfault. Soo, you got any other ideas?

By the way, thanks for replying so fast

-Scott


Soeren Sandmann wrote:

Scott Rubin <slr2777 cs rit edu> writes:

I think I may have done it wrong. To put it simply.  How can I force
the expose event to happen on the drawing_area widget whenever a
clicked event is signaled on one of my button widgets.  Thanks.

You should just queue a draw on the widget. Don't process_updates();
gtk+ will do that automatically in due course.

The standard way to do what you want is simply to

       g_signal_connect (G_OBJECT (button), "clicked",
                         G_CALLBACK (redraw), drawing_area);

with redraw() looking something like

       static void
redraw (GtkWidget *button, GtkWidget *drawing_area)
       {
               gtk_widget_queue_draw (drawing_area);
       }

Søren




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