Feedback case 55739 comments

And ImplicitInstance deals with existance, not visibility.

With ImplicitInstance on,

  • you don’t have to Dim a variable to hold the window
  • you don’t have to create the window
  • you can refer to the window by name

With ImplicitInstance off,

  • you have to Dim a variable (or create a property) to refer to the window
  • you have to create the window with New
  • you cannot refer to the window by name, you must use the variable/property instead

Thank you Norman.

I don’t think the main issue with FC 55739 is Visible but Implicit Instance, if you read OP’s comments the expected result was “Window is Hidden” because Window2 is not shown. After executing the code in the button, one of the properties is referred, so the window2 shows and the visible value is true, showing the message “Window is visible”.

Now I know that this behavior is documented in the notes. This morning, I didn’t know why the window behaved like that.

Following your example, what (some) rookies think:

  • I have 2 trucks and set them as visible (default truck1)
  • run the program, I expect to see both trucks, but I only see truck1
  • I check if truck2 is visible (expecting to get the answer as “not visible”)
  • then I see truck2 and get the answer “visible”
  • it is not clear why
    now I understand why, thanks to all of you. I will put what I understand in non-programmer phrases:
  • when you create a new project, you get a default window that the app will create at run time and will show it if Visible = True
  • when you have a second window, you are creating like a template, when you run your app it will not be created unless you add code to do it
  • the default on new Window (Window2) is Implicit Instance True and Visible True, so if I check any property of Window2 it will be created (Implicit Instance) and will be shown (Visible)

I may still have some things wrong, sorry for that.

I still think that an update to Window — Xojo documentation is needed, if you read the notes:

[quote]Notes
If True, the window will be visible when it is opened. After it is opened, setting Visible to False is equivalent to calling the Hide method. Or, if the window not initially shown, setting Visible to True is equivalent to calling the Show method.[/quote]
is talking about ‘opened’ instead of ‘instantiate/instantiated’ that is used on other window properties. Maybe that will make the first part more clear, but what about the second part:

and rookies thinking, I already set Visible to True on the inspector, why is not showing the window? then we change that to false, try again, then true again and no change.

I see the page was last updated in 2012, I know it doesn’t need to change for people knowing what to do, but it could be a better resource for rookies if there is more information there.

Sorry for my English, but something like this will make it clearer:

[quote]Notes
If True, the window will be visible when it is instantiated (be default only Window1 is instantiated). After it is instantiated and visible, setting Visible to False is equivalent to calling the Hide method. Or, if the window not initially shown because Visible was set to False when instantiated, setting Visible to True is equivalent to calling the Show method.

Setting Visible to True in the inspector, will not make the window show automatically. If you have a project with several windows, you can set the Default Window in App Inspector Appearance DefaultWindow.

See Also
Window.ImplicitInstanse[/quote]

Yeah, I know, maybe too much work but I think if you can reduce the learning curve and headaches for new users (pro and casual), the user base could increase.