Re: GtkTextView - blank space at the bottom of the
Philip Bunce <pjb@xxxxxxxxxx> writes:
> I am creating a GtkTextView using the following code...
> sw = gtk_scrolled_window_new(NULL, NULL);
> gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
> sailview.view.text = gtk_text_view_new ();
> sailview.view.buffer = gtk_text_view_get_buffer (
> GTK_TEXT_VIEW (sailview.view.text));
> gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (sailview.view.text),
> Notice that I have noscroll in the y axis
> The problem I am having is that when I write to this window (via the buffer)
> the window always expands to slightly
> more than it needs to in order to display the text. The extra amount seems to
> be approximately 33 pixels in the y axis
> when using "Courier 13", and no, my text does not have a trailing '\n' or
> Can anyone help?
> I would like the last line of text to be right at the bottom of the
Suggest writing a small, compilable test program, and put it in
bugzilla.gnome.org, I can look at it at some point. I'm not sure
offhand what's going wrong.
> In perhaps a related question. I would like to be able to use the
> mouse to resize the window. I have that working for expanding the
> window height, but it won't let me reduce the height. I was planning
> to use the allocate event to rewrite the text in the buffer with
> just the right amount (just like I do when expanding the window
> height). But there seems to be no way to do this since GTK won't let
> me use the mouse to shrink the window.
You can't shrink below the size request. So you need to reduce the
size request. gtk_widget_set_size_request() is the brute-force
mechanism for that.