Command-Line Name: -wraplength
	Database Name:  wrapLength
	Database Class: WrapLength
		For widgets that can perform word-wrapping, this option
		specifies the  maximum line  length.  Lines  that would
		exceed this length  are wrapped onto the  next line, so
		that no line is longer  than the specified length.  The
		value may be specified in any of the standard forms for
		screen distances.  If this value  is less than or equal
		to 0 then  no wrapping is done:  lines  will break only
		at newline characters in the text.
Apparently there is no provision for adapting the wraplength to the
width of the widget, as it is resized.
Any trick to achieve this? I'm thinking on binding to Configure and
assigning -wraplength from there, but I'm afraid of infinite loops or
redisplay problems.
> Apparently there is no provision for adapting the wraplength to the
> width of the widget, as it is resized.
I have this snip of old code handling it.  You'll have to replace some
hard-coded specific values though, like the font name and the "- 9".
        # for resizes, use the resized-size for wrapping
        set ww [expr { [winfo width $statwin.rs_htitles_l] - 9 }]
        if { $ww < 100 } { # for initialization when there's no width yet, use the preference value
            set pitch [expr { 0.1*[font measure muMonoFont {1234567890}] }]
            set ww [expr { int( $::PREF::textWidthMax*$pitch + 0.9 ) }]
        }
        $statwin.rs_htitles_l configure -wraplength $ww
> Any trick to achieve this? I'm thinking on binding to Configure and
That is in a proc bound to Configure,
Donald Arseneau                          as...@triumf.ca
Thanks.
As I don't understand the purpose of the `if { $ww < 100 .. ' the
solution was reduced to
bind $widget <Configure> \
  {%W configure -wraplength [expr {[winfo width %W] - 4}]}
which seems to work fine.
The -4 above (as your -9) is crucial. Without it the text becomes
invisible for some combinations of text width and ttk::label width.
Thanks again.