I want one window to make changes to another. How?

I understand that Windows are class instances and that one class should not delve too deeply into another class.

So I have a situation where when a Window opens, I want to change a TextField and also disable a Button in another Window. I know that I can easily do it during the Open Event of the opening window, but what I really would like to know is how to do it indirectly (if that is the way to put it). Perhaps doing it in the OpenEvent is the way to do it, but it just doesn’t sound right.

Thanks

It may be too much for your particular requirements in this project, but have you had a look at the Observer project within Example Projects\Design Patterns? I use it in my iOS project so that Views (Windows) can register to be notified when certain things happen. It is implemented using interfaces.

Thank you Jason. I had a feeling that it would be a Design Pattern, but I couldn’t work out which one.
Partly that was the reason for asking the question. I had hoped it would be a Design Pattern as this is the next thing I want to learn about. It probably will be overkill in my program, but at least I will be learning something.

Yes I agree Cliff. It is interesting to learn about interfaces even if you don’t really need to use them right now. And the funny thing about learning new things in Xojo is that you might find it tempting to refactor some existing code just to use the new thing in your project! :slight_smile:

That’s right. I am currently reading Martin Fowler’s Book Refactoring Improving the Design of Existing Code. It’s pretty hard going, but very interesting. I am also hoping it is going to keep the old brain working better.