Re: How to set gtk_entry size?



Paul Davis <pbd op net> writes:
> >> to demonstrate this function (which i trust made it into GTK+ 1.3), i
> >> enclose (once again):
> >
> >What we have in 1.3 is gtk_entry_set_width_chars(entry, n_chars). 
> 
> That can't be right. The text of characters in some fonts varies
> widely. If I want an entry to precisely contain "lllllllll", it may be
> totally different size than if I want it to contain
> "mxmxmxmxmxmxm". Not to mention issues with non-Latin1 text.
> 
> Oh well, I guess I'll keep posting gtk_entry_set_usize_from_given_text() :)
> 

There are no issues with non-Latin1 text. set_width_chars() uses the
'average char width' from the Pango font, which is somewhat a voodoo
number, but does consider the existence of non-Latin1. After all
that's the point of Pango.

set_width_chars() is intended for when you don't know exactly which
chars it will contain - if you know the entry will contain "lllllll"
then setting the usize is probably right, but also, using a label
rather than an entry is probably right. ;-)

Havoc





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