Problem with wrapping

I have a Gtk label to which I will be adding long texts. I’m using
WORD_WRAP, but the problem is it wraps the text in such a way that the
text only fills half the area of the label.

This being the screenshot:
http://drop.io/raro6ka8018/asset/wrap-png

And here’s the code:
http://pastie.org/607024

Any tips appreciated.

Thanks in advance,
Martin S

Martin Sarapik wrote:

I have a Gtk label to which I will be adding long texts. I’m using
WORD_WRAP, but the problem is it wraps the text in such a way that the
text only fills half the area of the label.

Any tips appreciated.

Have you tried tinkering with Gtk::Label#width_chars and
Gtk::Label#width_chars= ?

Alternatively, when you have a lot of text it might be worth going to a
read-only TextView.

Matt.

Thanks for the fast reply. I’ll play around with TextView and see how it
goes.

Yes, GtkTextView did the job nicely.

It’s interesting. Based on your program, here’s what I tried:

http://pastebin.ca/1556905

Console output is:

label size request: 408x1462
label size allocation: 600x300

The label requires 408x1462 for display, based on its text. Then, when
it’s allocated more width (600 instead of 408), it won’t use it to
reprocess the wrap and use the larger width…

http://zarb.org/~gc/t/gtl.png

I am not expert in Gtk Allocation enough to know if this behaviour is
normal or bad (or worse).

Anyway, the other advice to use a GtkTextView when in need to display
more than “labels” is also my choice.

On Sat, Sep 5, 2009 at 6:22 PM, Martin Sarapik[email protected] wrote:

Any tips appreciated.
ruby-gnome2-devel-en mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


Guillaume C. - http://zarb.org/~gc/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs