The closable Property

By setting the closable property to true, a close button is shown for the window, such that user could close the window by clicking the button. Once user clicks on the close button, an onClose event is sent to the window. It is processed by the onClose method of Window. Then, onClose, by default, detaches the window itself.

You can override it to do whatever you want. Or, you registered a listener to change the default behavior. For example, you might choose to hide rather than close.

<window closable="true" title="Detach on Close" border="normal" width="200px"
onClose="self.visible = false; event.stopPropagation();">
    In this example, this window hides itself when the close button is clicked.    
</window>

Notice that event.stopPropagation() must be called to prevent Window.onClose() being called.

Tip: If the window is a popup, the onOpen event will be sent to the window with open=false, when the popup is closed due to user's clicking outside of the window, or pressing ESC.

It is a bit confusing but onClose is sent to ask the server to detach or to hide the window. By default, the window is detached. Of course, the application can override it and do whatever it wants as described above.

On the other hand, onOpen is a notification. It is sent to notify the application that the client has hidden the window. The application cannot prevent it from be hidden, or change the behavior to be detached.