What is happening here?

Oh. Now I get it. That is handy. Thanks Emile and thanks again Ulrich.

You’re welcome.

The reason why you don’t really want to refer to windows by a specific name is your really want to try to uncouple your code from your UI as much as possible. For example, if you have a PopUp menu on Window1 and you want to change that PopUp menu on Window2, it’s considered a bad idea to write:

Window1.PopupMenu1.Listindex =3

From Window2. Rather you are better off keeping a reference to that PopUp menu someplace else like in a module or pass it in as a method parameter when you are switching to Window2, etc.

Now, Implicit Windows can be called by name wherever. The biggest issue is that if you have ANYTHING that is on that window and then you try to update that, the window will re-open. That is the nice thing about non-implicit windows you can do stuff like:

Dim w as New MyWindow
w.PopUpmenu1.Listindex = 3
w.MyProperty = "Hello World"
w.show

You can do all sorts of stuff treating it just like any other object, updating it and then calling show when you want it to be displayed.

There’s a lot of advanced Xojo programmers who say to NEVER use implicit windows. I use a mix of them and I’ve been using the language for almost 11 years now.

I hope this helps.

Hey Jon. Everything helps. Thanks for chiming in.

OMG don’t do this. You’ll never keep track of all of the references and it will cause memory leaks in your app. Basically while the window it is on will get destroyed, the popupmenu would stay around, disconnected from the window because you have a reference to it in this module.

Greg, you are correct. I misspoke. But similar things are done all the time with control arrays. It probably is better to pass a control as a method parameter.

Or what I meant to add as well, even better is to use something like Sam Rowland’s NotificationCenter to manipulate controls on one window from another.