logic behind or use of label->style->"gtk-label-wrap-width"->width, was: Re: configure-event on eventbox in composite widget
- From: "Karl H. Beckers" <karl h beckers gmx net>
- Cc: gtk-app-devel-list gnome org
- Subject: logic behind or use of label->style->"gtk-label-wrap-width"->width, was: Re: configure-event on eventbox in composite widget
- Date: Mon, 13 Sep 2004 14:39:46 +0200
Hi Matthias, Owen, et. al.
[...]
I was a little too enthusiastic, perhaps ... now I've shot myself in the
foot.
I have this hbox with a callback connected to size-allocate which (among
other things) changes the text in a label contained in the hbox. This
apparently generates another size-allocate event on the hbox ... a loop.
hat sounds very wrong. Whatever you are trying to achieve, connecting
to size-allocate is most likely not the right way to achieve it.
of course you're right, I might have explained what it is, I want to
achieve earlier.
I'm trying to get a label auto-line-wrap in a nice way when it is resized.
btw. I solved the previous problem by filtering any size-allocate events
that don't actually
change the widget's width (that was just an oversight on my side). This
approach works
considerably well.
However:
- the wrap width is NOT the size of the lable (which one could naively
understand from the
API docs)
- re-setting the text in a lable doesn't necessarily recalculate the
wrap_width
... in the sources I found a style property "gtk-label-wrap-width", but
I don't quite understand
it:
- Setting "gtk-label-wrap-width"->width = widget-width * 1000 seems to
make the text wrap
at roughly the widget's size ?!? *blink*
- Also, let's say I initially have 3 lines where I have manually
inserted one newline character.
If I make the label narrower, the line wrap will add lines. If I
make the the widget wider, the
second line will get longer (the first is manually terminated),
until some sort of maximum
is reached. Then the second line will get shorter again, and the
number of lines will never
drop down to 2, no matter how wide I make the widget. I can see that
the label does some
guessing of desired width's to beautify the output,
Do I read the following correctly, that the maximum wrap_width is 1/
2 the screen width?
(this is 2.4
http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtklabel.c?rev=1.150&view=markup)
1482 width = MIN (width,
1483 PANGO_SCALE * (gdk_screen_get_width
(screen) + 1) / 2);
- If I do a gtk_widget_set_size_request on the label, I can't get the
"gtk-label-wrap-width"
style property anymore?!?
TIA,
Karl.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]