I have this small movable modal window I use for some preferences, and there seems to be no way to hide the red dot close button on the upper left corner. I switch off Close button but still, it shows. As a result people close the window with it instead of clicking OK, and they lose the defaults. As a temporary workaround I save the default when the window is closed, but I does not feel quite right.
I thought I could modify the code posted below to suppress the button instead of showing it, but NSClosableWindowMask is deprecated.
https://forum.xojo.com/31291-force-close-button-to-show-on-cocoa-movable-modal
I will appreciate any idea.
OK. For the moment, I settled on the code below in Open, but I would prefer using something that is not deprecated. As usual, Apple documentation does not really help. They say it is deprecated, but fail to explain what replaces it. I would have hopped they put that in “see also” but all it does is redisplay the same page
[code]#If TargetCocoa
Const NSTitledWindowMask = 1
Const NSClosableWindowMask = 0
Declare Sub setStyleMask Lib “Cocoa.framework” _
selector “setStyleMask:” (obj_id As Int64, mask As Int64)
setStyleMask(Self.Handle, NSTitledWindowMask Or NSClosableWindowMask)
#EndIf
[/code]
Saving when clicking the close button is perfectly fine. But why is the option Close Button in the Inspector not working for you?
I would love to know why
Nothing special about the window, which is a plain and simple movable modal.
Really weird. I tried to open a movable modal on 10.13.6 and the IDEs button works as well as the styleMask declare.
Where is it that Apple says styleMask is deprecated? I found a deprecation mark only on StyleMaskTexturedBackground.