Re: [gtk-list] Re: improved notebooks?

Havoc Pennington wrote:

> Antonio Campos <> writes:
> > Nevertheless I encountered a runtime error, concretely:
> >
> > Gtk-CRITICAL **: file gtkwidget.c: line 3360 (gtk_widget_set_parent):
> > assertion `widget->parent == NULL' failed.
> >
> > Is there anything wrong with this?. I suspect that gtk_notebook is
> > complaining about the hbox not being a windowless widget. And I
> > correct?. Is this a big problem?
> >
> This is just what it says: widget->parent should be NULL and it
> isn't. i.e. the widget is already in a container, and you try to add
> it to another one. In your debugger, break on g_log and get a
> backtrace to see where you're adding the second time.
> > something we shouldn't lose. So could anyone fix the popup_menu in the
> > notebooks to show the label widgets correctly?.
> >
> Unclear how to do this, Gtk doesn't have copy constructors...

Sorry, I could have resolved my doubt without boring you all guys.
After looking closely at testgtk.c inside the gtk source distribution, I found

a new function undocumented in the gtk tutorial:
gtk_notebook_append_page_menu(notebook, child, label_box, menu_box)
( I suppose there exists gtk_notebook_prepend_page_menu too).
When you call this function you append a page in the notebook with the label
widget label_box, and the widget menu_box is shown when the popup menu is
I suppose that when one issues something like
the notebook widget expects label_box to be a "real label widget", and when
the pop up menu opens then label_box->text ? is shown. So for showing complex
widgets in the popup menu of the notebook the gtk_notebook_*_page_menu
functions must be used... (If only this would have been clearer in the
tutorial). I'm willing somebody will someday write a complete function
reference book on GTK.

Anyway the Gtk-Critical error is thrown when I call gtk_notebook_append_page
or gtk_notebook_append_page_menu, and I don't understand why my label_box (is
a hbox) has a parent with a window!=NULL because I just create the hbox, and
don't pack it inside any container. But hey, don't waste more time in this. It

just have to be a error of mine.

It took me some time to understand what you were saying with the words
"copy constructors", but I understand it now (good thing I read that
quick-and-dirty C++ book). It could have been a good thing to have menu_box to
be a "copy" or "pointer" widget to label_box.
A new question arises: is there a simple way to make a copy of a widget
without the obvious way of creating another one identical? Is there a simple
way to make a reference or pointer to a widget, so when I change one the other
also changes? Future plans to add this object functionality in new
GTK+ releases?

> > When I have a scrollable notebook, is it possible to make the
> > arrows (that appear to scroll the notebook) become DnD aware?. I mean,
> I bet you'd have to hack GtkNotebook for this.
> Havoc
> --
> To unsubscribe: mail -s unsubscribe < /dev/null

I am a lot behind you, gtk-hackers. Currently, I think that I am not ready to
hack any code, but I will try to convince Tim Janik to make the arrows of the
scrollable notebook accessible in some way:
GTK_WIDGET(GTK_NOTEBOOK(notebook)->prev_arrow) ?
GTK_WIDGET(GTK_NOTEBOOK(notebook)->next_arrow) ?
so DnD can be used with the arrows.
Hey, if we currently don't have MDI in GTK, at least we should have the
possibility of doing DnD with notebook arrows for drag and drop between opened

Although late, happy 2000 to all GTK/GNOME people...

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