Re: Request for GtkTable to allow reattachment of child widget



    Ang> I'm writing an application using Gtk, in which I use a GtkTable
    Ang> widget. On a table with a few widgets attached, I need to be able
    Ang> to dynamically change the attachment position of the child widgets.
    Ang> Current Gtk table implementation (1.2.8 and 1.2.10) don't allow
    Ang> this.

You don't mention what the symptoms are.  Are your child widgets getting
destroyed when you try to move them?  I've never used 1.2.x, but in 1.3.x I
have no problem changing child widgets' attachment points in a GtkTable.  I
use the PyGtk bindings, but I don't think that matters.  In fact, I have a
Box class that inherits from my Table class which allows you to change the
orientation of the Box on the fly.  It accomplishes this by disconnecting
each child, transposing the attachment indexes, and then reattaching the
child.  Works like a charm.  I also provide more Pythonic indexing, so the
code in the loop over the children is simply:

    w = self[col, row]
    del self[col, row]
    self[row, col] = w

Perhaps you are missing a ref() call before detaching the child widget from
the table.  If you deattach the child without calling ref() first perhaps
its ref count drops to zero and the child gets destroyed.

-- 
Skip Montanaro (skip pobox com)
http://www.mojam.com/
http://www.musi-cal.com/




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