Re: [gtk-list] Replacing an entire widget on the fly
- From: Havoc Pennington <hp redhat com>
- To: David Allen <opop erols com>
- cc: GTK+ List <gtk-list redhat com>
- Subject: Re: [gtk-list] Replacing an entire widget on the fly
- Date: Fri, 13 Aug 1999 21:23:54 -0400 (EDT)
On Fri, 13 Aug 1999, David Allen wrote:
>
> How would you replace an entire widget? Say I have some text widget in
> a table, or just in a window, and I want to take that out, and replace it
> with a button, or even just a different text widget?
>
You remove the first widget (by just destroying it, or
gtk_container_remove()), then pack the other one.
> What I tried was to gtk_destroy_widget(widget_in_question) then recreate it,
> then show it, then pack it back into the box, but packing doesn't seem to
> work after the window has been established,
It should, maybe you aren't showing the widget or something?
> and even so, I wouldn't be
> able to pack it back into the same place. (gtk_box_pack_(start|end) would
> put it at the start/end, wouldn't it?)
>
Try gtk_box_reorder_child() to move the newly-packed widget into place.
You could also add an additional container (such as another box, or a
GtkEventBox, or GtkAlignment) and use that container as a "socket" inside
the first box, so you can add/remove widgets from it.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]