Re: [gtk-list] Re: gtk--, gtk warning, Gtk_Text popping out of main wnd



On 14 Jun 1998, Tero Pulkkinen wrote:

> Tom Fishwick <tfishwick@coastnet.com> writes:
> >         I've run into a couple of problems.  In my program I have a main
> > window
> > that has a notebook in it.  i've made my own notebook class deriving it
> > from Gtk_Notebook, and in it, theres a list of Gtk_Label pointers.  So
> > when I add pages to the notebook, its like this append_page(&txtMain,
> > &lbl) (done within the notebook class) , I get a warning (most of the
> > time)
> > 
> > ** WARNING **: file gtkwidget.c: line 2469 (gtk_widget_set_parent):
> > "widget->parent == NULL"
> 
> I think you need to realize() the notebook before adding things to it.
> 
> > and I get two pages added with identical labels!  Could this be
> > happening because the Gtk_Labels don't know their parent (thats what the
> > warning seems to say?), cause there created in the notebook class I've
> > made?  Either way, any ideas on how to fix it would be nice :-).  I've
> > tried calling 'set_parent' but it didn't seem to do the trick.
> > 
> > My Second problem.  In my notebook class (derived from Gtk_Notebook)
> > when I do a 'remove_page(page)', the Gtk_Text accociated with the
> > notebook, pops out of the main window and floats.  
> 
> This sounds odd.
As for the second problem, I've had the same thing happen to me.  I'm not
sure if this will help, but what I did was make sure all widgets were
packed into a container and show()'ed before I inserted text into the text
widget.  Here's what I had:
  -Gtk_Window
  |--Gtk_VBox
     |--Gtk_Notebook
     |  |--Gtk_Text
     \--Gtk_MenuFactory

I first append_page()'d the text into the notebook, then packed the
notebook and menubar into the vbox, then added the vbox to the main
window.  If I realize()'d anything, they'd jump out of the main window and
become their own root window, so I'd advise against realizing the widgets
(although i'm not sure exactly what it does...)  Anyway, just make sure
everything is packed and show()'d before you insert text.  I hope that
works, it did for me.

---
Matt Perry [guy@mikepery.linuxos.org]

If two wrongs don't make a right, try three.
                -- Laurence J. Peter
---



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