Thanks for the reply.
Let me be a bit more specific. I have a GtkNotebook in a GtkWindow. In one of the tabs of the notebook, I would like to insert a GtkTextView. This GtkTextView will have an associated GtkTextBuffer. Before your email I was just gtk_container_add()ing the GtkTextView to the tab of the notebook. When I did this, the size of the top-level window would expand to the size of the text included in the GtkTextView. What I would like is to set the size of the top-level window (using gtk_window_set_default() is the way I'm doing it now), insert the GtkTextView into the notebook tab and have the GtkTextView conform to the set window size. If the text in the GtkTextView is too big to be displayed, the GtkTextView would automatically bring up horiz and vertical scrollbars to allow you to move around in the associated GtkTextBuffer. I'd also like to be able to append and prepend text to the GtkTextBuffer and have the GtkTextView update without its size changing. So, I was not using the GtkScrolledWindow before. I tried inserting that as you suggested using both gtk_container_add() and gtk_scrolled_window_add_with_viewport(). In both cases, the GtkTextView does not appear in the tab. Another interesting point. When I looked at the developer documentation for gtk_scrolled_window_add_with_viewport, I saw the following: "The viewport scrolls the child by moving its GdkWindow, and takes the size of the child to be the size of its toplevel GdkWindow. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as GtkTreeView with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the GtkViewport proxy." This seems to indicate that there is some sort of native scrolling associated with GtkTextView. If so, that's what I'm probably really interested in. Thanks, FM P.S. BTW, if you want to get an idea of the GUI I'm working with, look at http://www.cornfed.com/images/cornfedsipua/advanced/contacts.gif I'm adding a tab to this that will have call history in a GtkTextView. On Tue, 2005-09-13 at 01:19 -0400, Havoc Pennington wrote: > On Mon, 2005-09-12 at 21:01 -0400, Frank W. Miller wrote: > > > > Greetings, > > > > I don't know if this is the right list for this so if not I apologize in > > advance. > > > > Let's say I want to create a GtkTextView that has a set size at startup > > (regardless of its contents). Let's also say that I want the size of > > the GtkTextView to remain the same when I append text to it. I'd also > > like it to have horiz and vertical scrollbars that can be used to scroll > > around in the associated GtkTextBuffer while the GtkTextView remains the > > same size. > > > > How would I go about setting this up? > > > > Not sure your question makes sense. I think when you say size of the > TextView you may really mean the size of the GtkScrolledWindow > containing the text view, and when you say TextBuffer you may mean the > TextView. > > If so then you'd put the textview in a scrolled window, and the easiest > way to set the default size is gtk_window_set_default_size() on the > *toplevel* GtkWindow (not the scrolled window). But using > gtk_window_set_geometry_hints() and providing the scrolled window as a > geometry widget you could get more elaborate. Or there's > gtk_widget_set_size_request() on the scrolled window which sets its > minimum size. > > Havoc > _______________________________________________ gnome-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-devel-list
