Replacing a widget within a window



I've been trying to replace a widget completely within a window, with some
suggestions from Havoc, but it still doesn't seem to be working...the code
snippet I'm using is this...  (Previously, the widget was packed by itself
into another widget called widget_socket so I wouldn't have to mess around
with changing the position of it after I remade it.  widget_socket is packed
into another bigger box, which is added into the window)

gtk_widget_hide(the_widget);
gtk_widget_destroy(the_widget);

the_widget = gtk_button_new_with_label("Foobar");

gtk_box_pack_start(GTK_BOX(widget_socket), the_widget, FALSE, FALSE, 0);

gtk_widget_show(the_widget);
gtk_widget_show(widget_socket);  /* Already shown earlier, just making sure */

What ends up happening when this code runs is that the widget gets hidden,
then destroyed, the new widget is created, and never shows up on the screen.
Earlier, I did a gtk_window_set_policy so the window would autoshrink,
which it does.  The new widget never shows up though.  I've tried both with
and without hiding it first, the reason I hid it was so that if there was
some lag, the user wouldn't have to look at an ugly empty socket after the
widget was destroyed but before the new one came in.

I've also tried resizing the window after the widget reinsertion, just to 
make sure that it wasn't a window size growing issue after the new widget
was in.  It doesn't seem to be, since the rest of the bigger and resized 
window is of course empty.

Any suggestions?
-- 
David Allen
http://opop.nols.com/
----------------------------------------
Marriage is the only adventure open to the cowardly.
        -- Voltaire                                       



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