Re: Howto to tear a notebook page?

Hassan Aurag wrote:
>  Hi,
> I was wondering if any had any ideas on how to easily implement the
> tearing of a notebook page so that it can become a top-level window.
> I am using pygnome so the guys on pygtk list can help me better I
> think, but in case no pygtk guys/garls have any ideas, I also sent the
> same question to gnome-devel for implementation discussion.
> Thanks in advance

from the gtk faq:

5.16 How do I reparent a widget?

The normal way to reparent (ie change the owner) of a widget should be
to use
the function:

void gtk_widget_reparent (GtkWidget *widget, GtkWidget *new_parent)

But this is only a "should be" since this function does not correctly do
job on some specific widgets. The main goal of gtk_widget_reparent() is
avoid unrealizing widget if both widget and new_parent are realized (in
case, widget->window is successfully reparented).
The problem here is that some widgets in the GTK+ hierarchy have
attached X subwindows and this is notably the case for the GtkSpinButton
widget.For those, gtk_widget_reparent() will fail by leaving an
unrealized child
window where it should not.

To avoid this problem, simply use the following code snippet:

gtk_container_remove(GTK_CONTAINER(old_parent), widget);
gtk_container_add(GTK_CONTAINER(new_parent), widget);

hope this helps,


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