Determine "this canvas"
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Determine "this canvas"
If I have several objects of type Canvas, how can I determine which one to use for drawing the widget?
shiftLock happens
Re: Determine "this canvas"
@hh: The only canvas which can be used to draw to the widget, is 'this canvas' as it is at the start of the OnPaint handler. The canvas provided there only exists for as long as the OnPaint handler runs - any other Canvas's are 'offscreen' canvas objects which can be used to produce images.
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Determine "this canvas"
Thanks.
I'm trying to write a basic Canvas cheat sheet and was looking for the reason why we have to write in OnPaint such often "this canvas" although there is only one.
Now I see the way to do complicated (and time consuming) but "static" parts of an OnPaint handler only once and then insert these, whenever needed, as pixel data of <otherCanvas>.
This is probably faster than to organize the layering of several widgets. And easier, especially if some of theses layers are native.
I'm trying to write a basic Canvas cheat sheet and was looking for the reason why we have to write in OnPaint such often "this canvas" although there is only one.
Now I see the way to do complicated (and time consuming) but "static" parts of an OnPaint handler only once and then insert these, whenever needed, as pixel data of <otherCanvas>.
This is probably faster than to organize the layering of several widgets. And easier, especially if some of theses layers are native.
shiftLock happens