Re: [gtk-list] Re: Bug/Feature Destroying Widgets



On Mon, Mar 30, 1998 at 10:53:28AM -0500, Scott Dybiec wrote:
> > > A program that worked with a previous version of GTK (0.99.1) no longer
> > > destroys widgets with the gtk_widget_destroy() command.  If I try to
> > > destroy a frame, only things *in* the frame are destroyed, not the frame
> > > itself.
> >
> > That's not quite true. Well, it might be a bug, but not the bug you
> > described. I ran the program and forced a redraw by dragging the window out of
> > the screen and back again -- no frame any more.
> >
> > Maybe you should force a redraw of the window after destroying the frame.
> 
> Thanks for taking a look at the issue, Eckehard.  What's the right way to
> initiate the redraw?

You'd do it with gtk_widget_queue_draw. But I played with your code a bit
further and that wasn't enough to make it work.

> Seems like the gtk_widget_destroy() call should behave the same for both the
> container widget as well those widgets held within it. Why do some widgets (those
> contained) not need the redraw while the container does for it to disappear?

Actually the label didn't vanish for me also.

Hmm, I'd say the gtk+ developers did some optimization in the case widgets get
destroyed. They leave it to the programmer to queue a resize/draw when that
happens, since it is most unlikely someone really does that. Most windows are
static. The only exception to this I can think of at the moment is the
notebook, which will most likely handle the redraw better.

After looking at gtknotebook.c I added gtk_widget_unmap before destroying the
widget and a gtk_widget_queue_resize of the window after it (to resize the
remaining widgets to a correct value). That worked for me.

-- 
Eckehard Berns



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