Re: How to draw points on the drawing area?



Thanks for clearifying these issues. I cut a few corners in order to
give a newbie a quick answer. Appearently I cut a bit too much. I'll 
learn and improve. 8-)

Regards,
Dov

On Sun, Sep 15, 2002 at 07:43:30AM -0400, Paul Davis wrote:
> >First ignoring the PDU part. You draw to the drawing are with the gc_draw_*()
> >functions in the exposure event callback. Here is the critical code 
> >that you need to set up:
> >
> >
> >    gboolean event_handler (GtkWidget *drawing_area,
> >			    GdkEvent *event,
> >			    gpointer client_data)
> >    {
> >      if (event->type == GDK_EXPOSE)
> >	  draw_graphics((MyApp*)client_data);
> >
> >      return 1;
> >    }
> 
> a few points here:
> 
>     * connecting to the "event" signal is wasteful. it means that
>         your callback is executed for every single event on the
> 	widget. use the specific desired event if there is one,
> 	in this case "expose_event"
> 
>     * returning 1 is not correct. signal handlers return TRUE or
>       FALSE. small point, perhaps, but ...
> 
>     * return TRUE by default from a callback connected to "event"
>       is a bad idea. 
> 
> >About the PDU that you mentioned (though I have no idea what it is).
> >Whenever you have data to read on that channel you should get a
> >callback in which you read the data. You should then call draw_graphics()
> >manually to update the display.
> 
> no, thats not right. you would call either gtk_widget_queue_draw(), or
> use a GDK method such as gdk_window_invalidate_rect(). but the author
> already knows this. i think his problem(s) arise from not grasping the
> central role of the expose_event in GTK+ (a common problem).
> 
> --p
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list

-- 
                                                        ___   ___
                                                      /  o  \   o \
Dov Grobgeld                                         ( o  o  ) o   |
The Weizmann Institute of Science, Israel             \  o  /o  o /
"Where the tree of wisdom carries oranges"              | |   | |
                                                       _| |_ _| |_
 



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