On Tue, Dec 6, 2011 at 2:22 AM, Costin Chirvasuta <cost...@gmail.com> wrote: > I don't really understand what max-width-chars would be useful for.
The max-width-chars property is intended to limit the overall size request of a label. if max-width-chars is set, the label will not by default request a natural width of 'max-width-chars'... but if the label's actual width is larger, then the natural width request will be *limited* to a maximum of 'max-width-chars'. And of course, using either 'width-chars' or 'max-width-chars' is only legal if the label is ellipsizing or wrapping. The usefulness of limiting the natural width request of a label becomes more obvious when you try to, for instance fit a wrapping label beside an ellipsizing label in the same GtkBox: you don't want the wrapping label to compete for size after acquiring a fixed natural width. > Can't you set a "natural" size for a widget instead of a "natural" max gtk_widget_set_natural_size() has been suggested and is probably a good addition to the api (for this, patches are most probably welcome...) However, it might not always work as you would desire: gtk_widget_set_size_request() can only logically set the minimum size, since the GtkWidget api has no knowledge of the content to display, the real content might require more size. gtk_widget_set_natural_size_request() could hypothetically set a hard coded natural size request which is going to always be *at least minimum size*. > char width? If I want to ellipsize it won't do me any good if > "iiii..." is the same as "mmmm...". > Using a width in terms of charachters up until now has always been more practical than using pixel sizes. Because the width-chars property will ultimately use: pango_font_metrics_get_approximate_char_width() Which will take into account the chosen font and resolution. If you are setting 'width-chars', then your text is dynamic text which you are uncertain if it will fit in the ui or not. Instead of asking yourself the irrelevant question about the width of an 'i' vs the width of an 'a', you should be asking yourself "what does 50 pixels mean on this machine"... perhaps when displayed on a huge LCD panel, 50 pixels is less than the width of one character... > I can see there is gtk_set_size_request for setting minimum width, > gtk_window_set_default_size for setting maximum ("natural") width (if > I understand correctly) but for windows. What can I use to set the > maximum or "natural" size for a widget? gtk_window_set_default_size() does not effect any size request, its just supposed to set the default size of the GtkWindow when it initially shows up. However if you do NOT call set_default_size() manually, GTK+ will use the natural request as the default size. Cheers, -Tristan _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list