Clicking on a canvas

If I have, say, three canvases partially overlapping each other and I want to know the index number of the middle one by clicking on it I will get the index numbers of the one underneath it as well. Is there any way of making canvases “impermeable” so that only the topmost of the canvases under the click responds?

Clicks should be responded to in the Z-Order of the controls… and returning TRUE in the MouseDown event should insure the event stops then.

You would have to implement something like I did in The SimDesignerCanvas control. Once Xojo controls are compiled, their Z-order cannot be changed…unless you make a custom-control which virtualizes Z-order.

Thanks Dave; returning true stops the problem. BTW what is the “Z-order”?

Z-order refers to the layer order.

As in photoshop - 1 layer is on top of another.
It’s the same principle.

Thinking about your application in a 3d situation, the first control you place in a window is 0, the next is 1 and is placed infront of 0. Imagine them as control layers. They don’t exist on the same “plane,” rather in a “stack.” Sort of like an “array.” Although in a Xojo application, once the application is compiled, this order cannot be changed. Where as with an array we can pop one off and insert it within the stack anywhere we want. VB6, .Net, Delphi, C++ (pain in the ■■■■ to do), and other languages implement true z-order and arrangement methods for you. So although in Xojo we have “control arrays,” they don’t act as true arrays, as a true array can be arranged in any order dynamically… Thus why we call “control arrays,” "member sets. " Perhaps one day z-order manipulation will be available in xojo, since it is in essence, a fundamental control aspect.

Thank you both.