hi Tom,
Tom Schouten wrote: ...
any reason why canvas_current() only works in a constructor? i suppose this has to do with the canvas stack when loading a patch?
when i want to have access to the canvas at all times, i should save it in the constructor, right?
right, canvas_getcurrent() returns 0, unless there is a glist pushed on the #X-binding stack by someone calling canvas_setcurrent() first. That binding is updated whenever an object is to be created -- from a patch file, as well as interactively.
Btw, what you get from canvas_getcurrent() is the containing glist, which may happen to be displayed on parent. So, if you need the actual canvas, rather than just a glist, store that glist in the constructor first, but then call glist_getcanvas() each time it is used.
Krzysztof