Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Tk TableMatrix format part of cell

by zentara (Archbishop)
on Dec 03, 2018 at 14:25 UTC ( #1226662=note: print w/replies, xml ) Need Help??


in reply to Tk TableMatrix format part of cell

It works fine for small tables, but my doubt is: if the table grows in size and is dynamically generated, i.e. its rows are continuously created and destroyed, will this have effects on performances or even on stability? Or am I worrying too much?........ The question is if the table becomes to "heavy"/unstable if it grows in size and is frequently changed.

No, you are not worrying too much. An often overlooked problem with Tk problems is memory gain due to the repeated creation and destruction of widgets. Quite often it is discovered too late, and much work has to be discarded as a memory hog, so it is best you watch your memory consumption as you develop any complex Tk script.

First, the only Tk widget that will allow this is the Tk::Canvas, so if you really want this feature, use a Canvas, build your own table of cells, and tag your cell text accordingly.

If you really want to stick with the TableMatrix, your current method of sticking a Text widget in the cell, and using it's tag features is your best shot. I would just caution that you create just one text widget for this purpose and reuse it. This should eliminate any creation/destruction memory gains. See "perldoc -q clear" for how to keep your reusable Text widget free of old data.


I'm not really a human, but I play one on earth. ..... an animated JAPH

Replies are listed 'Best First'.
Re^2: Tk TableMatrix format part of cell
by IB2017 (Pilgrim) on Dec 03, 2018 at 15:49 UTC

    Thank you for your expertise. This is also the fear I have, and unfortunately I already make too much use of widget destroy and recreate in my big application (trying to convert it to a reuse policy).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1226662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2019-10-20 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?