
Don't ask to ask, just ask

Comment on


Making no claim to understanding tcl; what the code appears to be doing is:

  1. for each row in the table;
  2. query the text for each column within that row;
  3. split that text on newlines;
  4. find the maximum number of lines in any column within that row;
  5. set the row height for that row accordingly.

SOmething roughly equivalent in Perl terms to:

my $maxRows = $tableMatrix->cget( -rows ); my $maxCols = $tableMatrix->cget( -cols ); for my $r ( 1 .. $maxRows -1 ) { set $maxHeight = 1; for my $col ( 0 .. $maxCols - 1 ) { my $text = $tableMatrix->getText( -row => $row, -col => $col ) +; my $nLines = scalar split "\n", $text; if( $nLines > 1 and $maxHeight < $nLines ) { $maxHeight = $nLines; } } $tableMatrix->cset( row => $row, height => $maxHeight ); }

You'll have to work out the appropriate methods to call for what I've shown as getText() & cset().

In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Auto-adjust row height to line wrap in Tk-Tablematrix by BrowserUk

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (4)
    As of 2014-03-15 23:57 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (323 votes), past polls