Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^6: Auto-adjust row height to line wrap in Tk-Tablematrix

by elef (Friar)
on Feb 10, 2013 at 15:04 UTC ( #1018055=note: print w/replies, xml ) Need Help??

in reply to Re^5: Auto-adjust row height to line wrap in Tk-Tablematrix
in thread Auto-adjust row height to line wrap in Tk-Tablematrix

My guess is that the TableMatrix widget keeps two copies of the text. One that reflects the applications view of that text; and one that gets manipulated for the display purposes. And what you are querying is the former rather than the latter.
That's what it looks like.

Maybe if you could work out the appropriate incantations for using the windowCget() method to obtain the text from the cells directly rather than via the TableMatrix, it might return the wrapped text.
That could work but I don't know how to figure out said incantations. I might email the TableMatrix author to see if he has some easy solution up his sleeve but the module hasn't been updated in 5 years so hopes are slim.

I also found this:
It looks like that TableMatrix does not support auto-resize. But it won't be too difficult for you to calculate the number of lines that the text of a cell occupies. To simplify the matter: 1) don't auto-resize the width (use ColWidth function to get the current width of a cell), and only auto-resize the height; 2) Measure height and width in characters, not pixels. When you calculate the number of lines, don't forget to handle special characters like \n. Call RowHeight to resize the cell (height only). -

The trouble is that I would need to abandon width auto-resizing (it seems that colWidth doesn't report correct values if a column is auto-resized to fit the window. On top of that, if a column is resized by dragging the border, it reports width in pixels, not characters.)
  • Comment on Re^6: Auto-adjust row height to line wrap in Tk-Tablematrix

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018055]
[Corion]: You'll only ever need that option if you have a long-running query whose results are not cached by your DB already, and in those cases I presume that the programmer will want to maintain the temporary tables themselves - I wouldn't know when to drop ...
[Corion]: ... the temporary tables, and also don't have a good idea on how to create unique table names for them
[hippo]: OIC. In that case leave it out but invite feature requests and see if any of the users suggest it. :-)
[Corion]: Talking about this makes me realize that it's likely only a half useful idea. But it still would be convenient to have as an option...
[Corion]: hippo: Hmmm - yeah, I could document it and wait for code implementing that option to show up ;-D

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2017-02-23 15:39 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (347 votes). Check out past polls.