Re: GtkTextView - blank space at the bottom of the window



At 05:41 PM 3/27/2002 -0500, Havoc Pennington wrote:

Philip Bunce <pjb carmel com> 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),
                 GTK_POLICY_AUTOMATIC,
                 GTK_POLICY_NEVER);
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),
                             GTK_WRAP_NONE);

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 '\r'.

Can anyone help?
I would like the last line of text to be right at the bottom of the
window.

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.

Ok. But how do I know when a user is trying to shrink the window? The allocate event
doesn't get generated until the user releases the mouse button. Is there another
event that I could use to issue a gtk_widget_set_size_request()?





Havoc

--------------------------------------------------------------------
--           Philip J. Bunce, Software Consultant
--     MIPS Assembly, Embedded Systems, PMON, UNIX, & C
--  Ph: 831-659-5684 Fax: 501-325-6812 http://www.carmel.com
--------------------------------------------------------------------





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