Re: nevermind 2nd part of my last question

this just replaces the widget I am removing with a label, correct?  So the
table will still be the same size, just with a blank spot where the widget
I removed used to be, correct?

I need to remove the widget and resize the table so that there are no empty
spots.  I'm not sure if a table is the best container to use for this, but
other containers I've looked at (i.e. CList) give no way to add or remove
columns. In fact, I can't find -any- container widgets that support 
removing one of its children.  Perhaps I've overlooked something. 
If anyone has a suggestion, I'd appreciate it.


On Tue, Jul 16, 2002 at 08:04:27AM +0200, Todd Goyen wrote:
I know a hack way to do this, but wonder why you would want to.
Anyway the table struct contains a GList holding all of the child widgets as seen below:

struct _GtkTable
  GtkContainer container;
  GList *children;
  GtkTableRowCol *rows;
  GtkTableRowCol *cols;
  guint16 nrows;
  guint16 ncols;
  guint16 column_spacing;
  guint16 row_spacing;
  guint homogeneous : 1;

if you have the pointer of the widget you would like to remove you could do this:

GtkWidget *table;
GtkWidget *old_label;
GtkWidget *temp;
GtkWidget *new_label;
GList *children;

new_label = gtk_label_new("new label");

children = g_list_first(GTK_TABLE(table)->children);
while (children) {
    temp = children->data;
    children = children->next;
    if (temp == old_label) {
       temp = new_label;
       gtk_widget_destroy (old_label);

the code would replace the widget pointer but you may need to queue a resize and a draw to get it to 
appear, and this is an evil hack if ever there were one.


On Tue, 16 Jul 2002 00:32:08 -0500
Ronald Roth <rroth uiuc edu> wrote:
Nevermind the 2nd part of the my last email, regarding gtk_table_resize.

but I would still like to know how one can remove children from a table.


gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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