Follow up on why shadowing should be avoided

Shadowing is usually a bad thing. But you can “sort of” do it right as I explained previously. I say sort of because there are some gotcha’s – one of which I’ll explain here.

However, there are still gotcha’s that can’t be worked around. Some of them are because of how the Xojo framework does things. Like control locking.

You’d think that for locking purposes the framework would set the instance’ left, top, width and height and, if properly shadowed, the instance computed properties would get set and they could pass the change along to their super class and voila everything would be happy.

In a perfect world this would be the case. But that doesnt appear to be how the framework does locking and so when you DO shadow a property like left, top, width or height the framework appears to cast everything to be a RectControl and sets whatever underlying properties it has thereby bypassing whatever shadowing you have so neatly set up.

And what you get is an issue like in this thread. Its unfortunate as shadowing would be a ton more useful if things like this worked by setting the instance’ properties.

Now, setting up shadowed properties “right” is a more advanced topic but if you’re doing this then you really need to understand what you’re doing and how to not make a mess.

But if it worked as I described above it would be super useful.