How can disable the "Move Window to Left Side of Screen" option of window's resize button?

Hi,

I am not sure about the real reason of my case, when I use NSWindow of my window's base class, the options
(Zoom, Move Window to Left Side of Screen, Move Window to Right Side of Screen, ... etc) that when I hover on the resize button are disabled.

But when I change my window's base class to NSPanel,
these options are enabled.

What I want is disabling all options in the option menu and keeping zoom function only on the resize button.

Are there some attribute that I can set to disable these options?

Thank you~~

Eric


Replies

Move Window to Left Side

Do you mean:
Tile Window to Left Side

What you can do is disable the button:
  • in IB, select the window (in the windowController)

  • Open Attributes Inspector

  • There is a "Control" section

  • Uncheck Resize

I'vo not found how to disable sub options.

Maybe you could do something in
Code Block
optional func windowWillResize(_ sender: NSWindow,
to frameSize: NSSize) -> NSSize

to forbid the change to a split screen format…
Thanks, I just want to disable the submenu and make the submenu's option gray to avoid user's selection and keep the resize button on. I need this behavior caused by I have to sync other function's behavior in my application that are used NSWindow instead of NSPanel.
I try to subclass NSWindow directly, I found that once I set worksWhenModal to true, then the menu will become available and disable when I set worksWhenModal to false.

Seems the menu item's enable/disable affected directly by the message related setting.
Are there something I can do the testing about this hint?

Thanks~