in reply to Re: Auto-adjust row height to line wrap in Tk-Tablematrix
in thread Auto-adjust row height to line wrap in Tk-Tablematrix
This seems to assume that there are \n characters in the strings. I am using -wrap => 1, to get automatic line wraps, and I don't think that it inserts \n in the string. It just displays it wrapped without altering the string itself, so I don't think my $nLines = scalar split "\n", $text; would work. But I've been wrong before...
Of course I could perhaps query the width of each column, use a monospace font and do the line wraps myself with \n, in which case of course I would know how many lines each cell is wrapped into, and I could set the height accordingly. But that would essentially mean that I'm rewriting the functionality of -wrap from scratch. There should be a better way - to be honest, I don't really see the usefulness of -wrap if there is no height auto-adjustment functionality. Instead of hanging off the cell to the right, text just ends up hanging off the top and bottom.
Of course I could perhaps query the width of each column, use a monospace font and do the line wraps myself with \n, in which case of course I would know how many lines each cell is wrapped into, and I could set the height accordingly. But that would essentially mean that I'm rewriting the functionality of -wrap from scratch. There should be a better way - to be honest, I don't really see the usefulness of -wrap if there is no height auto-adjustment functionality. Instead of hanging off the cell to the right, text just ends up hanging off the top and bottom.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Auto-adjust row height to line wrap in Tk-Tablematrix
by BrowserUk (Patriarch) on Feb 09, 2013 at 16:02 UTC | |
by elef (Friar) on Feb 09, 2013 at 18:15 UTC | |
by BrowserUk (Patriarch) on Feb 10, 2013 at 12:56 UTC | |
by elef (Friar) on Feb 10, 2013 at 15:04 UTC |
In Section
Seekers of Perl Wisdom