Re: Contents of VBox don't draw after putting it in Viewport



Tristan Van Berkom wrote:

If for instance, your toplevel widget is already realized then adding
pages to the notebook (and thier contents recursively) will result in
all pages being realized at the start, on the other hand if your toplevel
is invisible, or your notebook is not anchored at creation time (anchored
means "inside a toplevel somewhere"), then the subhierarchies will
only be realized when those pages are gtk_widget_show()n AND in an
active notebook page.

You might try making sure that all of your pages are realized at the
startup, this would typically mean after glade_xml_new() with a visible
toplevel, you would call gtk_notebook_set_page() for each page provoking
a realize before ever entering gtk_main().

The contents do appear when I add the vbox to the page directly.  It is only
when I add the vbox to a scrolledwindow with viewport and then add the
scrolledwindow to the page that nothing appears when I select the page.  I
think that this behavior exonerates the notebook.  Nevertheless, I tried
catching the realize signal on the vbox, the viewport, the scrolledwindow,
and a widget in the vbox.  I do get all the signals when I switch to the
page.  Finally, note that with the modified code (in which page 1 appears
first), I do see a combobox when I switch to page 0 (it is not in the
scrolledwindow with viewport).  I believe that its appearance confirms
again that the page is being realized.  It is only the contents of the
scrolledwindow/viewport/vbox on the same page that do not appear.

Thank you for your suggestions.  By suggesting new directions, they provide
exactly the sort of help I need.  I can think of only a few reasons for
widgets not to appear.  Failure to realize is one.  Perhaps it is still a
possibility if my analysis above is flawed.  Visibility is another, but I
am already calling show_all on the scrolledwindow.  Could they be
positioned incorrectly?  Is there something I may need to do to the
scrolledwindow to get it positioned correctly?  I tried catching the
realize and size-allocate signals.  When the widgets are realized, their
allocation is (-1, -1, 1, 1).  They never get a size-allocate signal.  When
I add the vbox to the notebook directly, their allocation is the same when
they are realized but then they are immediately allocated.  It seems that
the widgets are invisible not because they are not being realized, but
because they are not being sized.
-- 
Jeffrey Barish




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