Store Window Position

beatpiet's icon

Hi guys, I'm desperate right now. Basically a simple task and this has already been discussed here in the forum. But I did not find a solution there either.

I just want to make my main window (patch) save its position in a standalone. I have now made it so that the window position is stored in a pattstorage. Pattstorage creates a json file when closing. This file will be read out when opening and passed to "thispatcher".

The problem is that the window position is not written to pattstorage when closing. And I do not understand why?

Maybe someone might like to have a look at my example patch.

Thanks for your help..,
Peter

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon


or use txt files, you are more flexible with those.

i would also never count on [closebang] to work. it is better to save data to files whenever new data is generated. with the additional effect that settings can also be recalled after a crash.

beatpiet's icon

Hi Roman,

I could save the window position manually instead of using a closebang. But this always requires a user action. Or I use mousestate!?

beatpiet's icon

or metro?

Roman Thilenius's icon


yeah, i forgot that thispatcher doesnt report on its own. :)

[mousestate] doesnt report from alone either.

what would be cool would be an object like the opposite of [mousefilter]... or like [key]... which sends a bang when you release the mousebutton.

using a qmetro 500 will also work, but IMHO is a really shitty solution when it is about more that one window.


Roman Thilenius's icon


[hi] would. but...

Source Audio's icon

I use Quit Button on all my standalone apps
to enforce storage of all kind of needed data prior to quit.
So quit would store all needed first, than after short delay bang

;
max quit

message
To disable quit shortcuts Command-Q Mac and
Control -Q on Windows is a bit challenging,
but possible.

Roman Thilenius's icon


yes exactly, a "custom quit" would be the best way.

one can still combine it with an autosave once every minute, like some games or graphics apps do it, to catch up settings in the case of a crash.

beatpiet's icon

Okay, that's a good idea.

Thanks for the help.

But I have a much bigger problem at the moment.
See here::
https://cycling74.com/forums/trouble-with-subpatches-and-patcher-tab