Hiding a window

What’s the difference between window.hide and window.visible = false

One’s a method, the other is a property. But you probably want a better answer than that.

Yes I do, thanks :slight_smile:
As they both seem to accomplish the same thing, I was wondering under what circumstances I would use one in preference to the other.

The real difference is between Window.Visible=True and Window.Show : the latter makes a window visible AND moves it to the front. However there are bugs in Cocoa apps:

Thanks for the hint to the bug reports, Michael!

I wonder if this is a Xojo bug or something within Cocoa. I am running into the same problems : Window.close doesn’t set visible to false. I thought the NSWindow representation I have for this window should be correct then, but it’s the same: NSWindow.isvisible is true even when the window is hidden or closed.


I found this hint indicating that on other development systems the same problem arises:

Anyway, this offers a workaround: When you define an NSWindow instance of your window using for example MacOSLib, the NSWindow.isvisible property will be true after a normal close as well.
Choosing NSWindow.orderout instead puts isvisible reliably to false.