If you can draw directly to a window and do all of what you would do to a canvas contra on a window, doesn’t this make the canvas control somewhat redundant?
Canvas allows you to limit the scope of each drawing area. Encapsulation and all that. Think OOP.
Thanks Tim, but you took your time answering.
A canvas can be placed over other controls, moved around, made invisible without having to remove the picture from the window, even overlaid on top of a Mac window bar. You can also place controls over it and scroll them. And am sure I forget more
The canvas is also a great control to subclass if you want to build your own custom controls.
Canvas controls rock. One of the absolute best controls in Xojo.
The canvas control is very versatile. It lets you group controls, create your own custom control with all of the appropriate events, it lets you scroll controls that are placed on it, and and it lets you do whatever drawing you want on it. And I think I’ve missed a few things it can do.
It’s one of the most powerful controls in Xojo. Container Controls are a close 2nd for me.
Double Buffer says it all. I would cover an entire window with a canvas before I use the window background.
Well, overlapping controls can cause massive flicker so that may not be a great idea in some cases.
Chris, if you really want to dig into the canvas control and discover some of its uses, Eugene Dakin released a book on the topic titled
Alain Bailleul also has some great projects on his Alwaysbusy’s Corner blog. I learned a lot about how to use the canvas control by working through his examples.
[quote=132803:@Alwyn Bester]if you really want to dig into the canvas control and discover some of its uses, Eugene Dakin released a book on the topic titled
“I Wish I Knew How To
Program the Canvas Control with Xojo Desktop” [/quote]
Many thanks for the tip, Alwyn!!! … just went to Great White Software and bought Eugene’s book (and a few more while I was there). All I can say is, " I wish I would have had this months ago." It’s kinda like “The Bible of the Canvas Control” … if it has anything to do with a canvas control, looks like Eugene covered it in his book. Well, there goes my evening tonight … got as lot of reading to catch up on ^^