[gtkada] Problem with drawing

Emmanuel Briot briot at ACT-Europe.FR
Thu Nov 29 15:38:34 CET 2001


Michael Gonzalez <mgh at unican.es> writes:

> I have a drawing window for which I wrote a handler for the expose event
> that copies a pixmap into the window. From my main program I can make
> changes to the drawing, then re-draw the window using a Queue_Draw
> operation, and then let GtkAda process the events with the  following
> loop (suggested in the reference manual):
> 
>     while Gtk.Main.Events_Pending loop 
>          Dead := Gtk.Main.Main_Iteration; 
>     end loop;


Why do you need to explicitely use this loop ? The Gtk main loop should do it
for you ?
Unless you have a routine that is slow and you need to refresh the screen, the
above loop shouldn't be needed. And even in that case, it is probably better to
implement things in an idle callback (see Gtk.Main), and give back the control
to gtk+ periodically.

You could try to return True from your expose_event handler to stop its
propagation. Maybe what happens is that some other widget receives the event
and queues a drawing request as well.
Or try calling Gtk.Handlers.Emit_Stop_By_Name.

regards,
Emmanuel




More information about the gtkada mailing list