Closing fullscreen distorts canvas order

Hello all, pretty deep into my first major Xojo OS X build. So far have been able to solve problems via existing threads but can’t figure this one out:

My main window consists of 4 layered canvases. When drag/resize the window with the mouse to any shape/size there are no issues–everything stays in order. I can also go to fullscreen mode from any window size and have no problems. However, whenever I close fullscreen back to a smaller window (like, say, 600x400px) my canvases start getting out of order, or disappearing altogether. If this occurs, I can resize the window larger with the mouse until they pop back into view, and then resize them back to a small window without issue. It just seems the direct resize from fullscreen straight to a small window is causing the issue.

Any suggestions would be great. Thanks.
Jason

With ‘layered’, you mean that the canvasses are stacked on top of each other right?
Did you make sure that they are actually stacked? It can be a bit tricky sometimes because if you move them around by typing different Left/Top in the inspector, it sometimes looks as if they’re on top of each other but they’re not.

When dragging the canvasses around, make sure that the container/parent has the red outline before you drop it. Like this:

Thanks. This may have been the issue. I actually ended up scrapping the multiple canvas model and instead did all the drawing on a single canvas – ends up a lot cleaner and I can guarantee order by order of drawing in ‘Paint’ method.

Is one practice considered better than the other (multiple canvases vs multiple objects on one canvas)?

Thanks again for your help. The visual was great too, made it really easy to understand your point.

J

Personally, I try to avoid stacking canvasses, container controls, page panels tab panels etc. as much as possible.
In many case you have to but if it’s not necessary, I prefer not to stack things. Even if it’s sometimes a little more work, I find it cleaner and easier to handle things in 1 Canvas instead of 5 on top of each other.
Also, everyone keeps warning about flickering and weird effects on Windows when you’re stacking things.

Actually, I have observed flickering on Mac as well. If you place anything over a canvas and start painting into it, it does flicker on both platforms. Most notably if you use a Canvas to scroll controls, never paint into it. Better use a Backdrop.

Michel,

What is the basic rule? Never stack anything? How does that work with CC’s? Or a Canvas on a CC?
And a Canvas with a button or textarea on it?
And if do you that, it won’t flicker if you turn on/off double buffering?

Just asking because I haven’t done Windows but I’m about to.

The only controls that should be stacked are under the Organizers tab in Library, Group Box, Page Panel and Tab Panel.

Everything else has the possibility to z-order fight if things aren’t done correctly.

[quote=267004:@Marco Hof]Michel,

What is the basic rule? Never stack anything? How does that work with CC’s? Or a Canvas on a CC?
And a Canvas with a button or textarea on it?
And if do you that, it won’t flicker if you turn on/off double buffering?

Just asking because I haven’t done Windows but I’m about to.[/quote]

The basic rule is : don’t paint in a canvas if you use it as container, that is if you place a button or another control on top of it. Use the canvas backdrop instead.

I would gather the same would hold true for ContainerControls. In Windows, I tried once to paint in a Window, the result was terrible flicker. Same thing : use a backdrop, and flicker disappears.

As a general rule, Windows controls apart from containers (groupboax, pagepanel, tabpanel, Canvas, ContainerControl) should not be stacked. There are even controls such as TextField that pop through anything on top when the mouse passes over.

Mac allows stacking of whatever on top of whatever else and because of the hardware double buffering it really takes a lot to make it flicker (well, don’t put anything over an HTMLViewer). The big issue usually comes when a Mac developer decides to move to Windows, and the usual statement comes “on Mac it works perfectly”, often followed by “I hate Windows”.

When in Rome, speak Italian, don’t complain it works in English and you hate Rome…

:slight_smile: Visual Studio has full control over the z-order of controls, I’ve yet to find it in Xojo, so it’s not really a “Windows” problem per se

Well, Xojo has control over Z-Order as well at design time with the little position thingies over the central pane of the layout editor. Unfortunately, to access Z-Order in code requires using a declare.

But the issue is not so much with that. Xojo uses Win32, which being not double buffered, tends to flicker. And when a Mac developer encounter that, prejudice gets the best of him.

The <https://xojo.com/issue/28733> feature request to have Xojo Windows use .NET ranks 6th, but yet, it does not look that when VB has used .NET since 2002 fourteen years ago, Xojo has any plan to update.

Actually today with the UWP application model, it would make sense to go not only .NET but also AppX. Well, I suppose since that is #NotMadeByApple, it will probably never happen.