Re: Help required with TextView widget

On Jan 31, 2007, at 1:07 AM, Ashwin Ramachandran wrote:

The above code, has "word" wrapping and scrollbar policy set to 'auto, auto'.When you expand the window fully and start typing in, the words do not appear to wrap around at the shown margin, but wrap around much later than 80cols. [I observed this behaviour in gedit also].
Is there some other setting that I need to do for this?
I need to get the words wrapped around at exactly 80columns. Please let me know if I have missed
something here.

I recall writing some code, for this very mailing list, once upon a time... but i cannot find it. Alas. Anyway, the trick was to, in the textview's size-allocate, check whether the allocated space for the widget is wider than the desired wrap width, and, if so, adjust the textview's right margin to make up the difference. This required measuring a string, which assumed you are using a monospaced font. If the window is narrower than the wrap width, it had to set the size request of the textview such that the scrolled window would activate the horizontal scrollbar.

I cannot find this code.  :-/

However, that suggestion should give you something to experiment with.

(By the way, SourceView has the nice feature to show the right margin, but you'll have to set the property yourself to make the wrapping honor it.)

Doing a good job around here is like wetting your pants in a dark suit; you get a warm feeling, but no one notices.
  -- unknown

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