Re: [gtk-list] Text Widget: getting number of lines?



In a previous message, Todd Dukes says:
> I have a text widget (Gtk_Text in gtk--) that I am using as a long
> label.
> I have word wrap turned on. I would like to size the widget as close to
> the size needed for the text as possible.
> 
> Is there any way to get the number of lines text that were generated by
> the word-wrap so I can set the size of the Gtk_Text widget?

Not to my knowledge, but you can try embedding newlines ("\n") in the text
and using a label with left justification instead.  That will make the
widget about the same size as the text, except you have to know ahead of
time where to stuff the newlines.  This works if the text for the label is
statically defined, but could be problematic (re: you'll have to write
extra code to stuff in newlines manually) if the text changes dynamically.

Of course if you need to be able to edit this text, then this method won't
help, unfortunately.
-- 
Michael J. Hammel           |
The Graphics Muse           | Error, no keyboard - press F1 to continue.
mjhammel@graphics-muse.org  |
http://www.graphics-muse.org 



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