Block patch closure with text Confirmation

GustavoRhomas's icon

I have a patch that I need to ensure stays open during performances, is it possible to block any accidental closure attempts with additional text confirmation?

I attempted using a close bang with dialogue, and this "works" but by the time the close bang detects the patch close and text dialogue opens, the patch is already closed.

Thank you for any insight!

Roman Thilenius's icon

i would remove the window´s toolbar (thispatcher.help) against accidential mouseclicks - only command-W will of course survive this.

Source Audio's icon

As Roman suggested disable close,minimise etc flags to thispatcher

For Standalone approach would be a bit different on mac or win.

One should disable all possible means of quitting app

beside long press on a dedicated button.

which sends

;

max quit

message on mac, windows version needs

a bit more work due to audio settings storage bug.

Roman Thilenius's icon

i wonder what would happen when we had a class or function such as the [onecopy] object, which would prevent the parent window from beeing closed by the runtime(´s keyboard command) in any situation.

then you could only close this patcher by force-quitting the max app from the OS level (which usually involved an are-you-sure dialog as requested by the OP.) would that be a useful function?

command-W to my knowledge usually calls an OS level function anyway, so you can not just hack the menus of the maxruntime, like you could do for command-S and command-Q.


Roman Thilenius's icon

moment. as it seems, on windows the window style (notitle) already blocks the keyboard command, too. it does not do this on mac.

what is left as homework is to implement a possibility to move the window around in case that is required.

TFL's icon

implement a possibility to move the window around in case that is required

Hint: only one object with one changed attribute is needed.

GustavoRhomas's icon

Thank you for the insight everyone! It seems I'll need to find a creative way around my specific use case.

During my performance I have a few different parameters that are adjusted from sub-patcher windows, so I have been opening those and using command+W to close those sub-patcher windows when I am done with them. This, on a few occasions, has resulted in accidentally pressing command+W one too many times and accidentally closing the main patch.

If it's not possible to disable Command+W because of its inherent OS level control, then maybe I need to implement a custom "close window patch" hot key combination for my performance. Which would then allow for a special prompt to be written for my main patch. Either this or I need to re-think my approach of navigating the parameter controls of my project.

TFL's icon

You can change that shortcut specifically for Max in /Applications/Max.app/Contents/Resources/C74/interfaces/maxinterface.json ! Look for the "Close" shortcut, and change W by something else.

Caveheats are that you cannot easily enable/disable this (you need to edit the file and relaunch Max), and it is not persistent across Max updates I guess.