You need to cycle through cords of a visible canvas b/c even though a canvas is open they may not be placed in a visible part of that canvas. Of course lingering question is what is in the end faster in tcl/tk land: cycling through objects and refreshing them (which would be the cleaner thing to do) or simply refreshing entire canvas and trusting that tcl/tk is implemented so efficiently that its execution offsets time required for redundant redraws.
NB: Apologies for top posting--still trying to figure out my new phone.
Cheers!
Mathieu Bouchard matju@artengine.ca wrote:
On Sat, 21 Nov 2009, Ivica Ico Bukvic wrote:
There should be a loop that goes through all existing cords and checks whether they are visible and if so, raises them. Otherwise, they should be ignored.
Why would you need to loop through all existing cords?... I don't understand.
You need to perform only one check per canvas. Basically, if glist==glist_getcanvas(glist), then a canvas' cords are visible when the canvas itself is visible, and if this pd canvas also has a tk canvas, then it can tell the tk canvas to raise all_cords and that's all. You don't need an explicit loop and you don't benefit from one.
(unless someone found a speed optimisation in the use of tk, but then, it would involve more checks than what we're talking about here, and more accounting in order to avoid unnecessary refreshes, etc)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801