Search code examples
smalltalkpharo

pharo smalltalk Window closing


I am using Pharo Smalltalk version 4.0 to build a simple GUI app. I wish to make sure that "StandardWindow" that I have created does not close when the user clicks on the "X" button in the top corner. Hence, I am sending the message "mustNotClose" to my window object, which is an instance variable of the superclass SystemWindow. However, the window still closes when I click on the "X" button. Any ideas about what am I missing? Any help will be greatly appreciated.


Solution

  • The method mustNotClose is only an accessor for checking that the instance variable mustNotClose is set to true:

    mustNotClose
        ^ mustNotClose == true
    

    You should use the method makeUnclosable that actually deletes the close button. You can then add the close button back using makeClosable.