Resize and Center Windows

Josep Garces's icon

I made a patch that resize and zoom the windows. When It does calculate the zoom factor and the windows size. Resize and zoom works well, but the inside of the windows gets off position.

https://www.facebook.com/josepet.bass/videos/10224155387176283/

I'm using "windows size f f f f, window exec" and "zoomfactor f" messages to [thispatcher]

How can I fix this?

More suggestion for resizing windows?


Pedro Santos's icon
Josep Garces's icon

Hi Pedro,

Thank you! this looks really cool! I think this will solve the issue!

Josep Garces's icon

Hi Pedro,

I just found one issue. The dimensions of my patch can be 2 different, depends of some options. So it is for example: 300x200 and 300x150. I guess the argument cannot be changed, so I tried to make 2 copies of the object but it didn't work properly.

Could this issue be solved in the js code?

thank you so much!

Pedro Santos's icon

Yes, I've tried to change the code accordingly and it seems to be working. Cheers!

ps.window_zoom v2.zip
application/zip 3.96 KB

Josep Garces's icon

Hi Pedro, this is exactly what I need. It works really good. Thank you!!!

Josep Garces's icon

Hi Pedro, just one little think :)

When I use the js code, the window open automatically in the middle. Could this be adjusted to open on left top side of the windows? Also, could it be a way to send a band to show the window? So, if there is no bang, no windows shown. This would make it easier to use with few more features that are very handy.

Thank you!!

Pedro Santos's icon

Hi, Josep. The position in which the patch is opened is the same as the position it was last saved.
I programmed the js code to be easier to resize and automatically rescale the window, which was not easy to do with regular Max objects. For the suggestions you mentioned, though, the "thispatcher" and "pcontrol" objects can complement the js code I wrote.

piedagile's icon

Hello all
Thank you for the many idea in your posts. I propose to share my synthesis here. It works: Open the attached patch and try it. Then set View Toolbar, set in patching mode, open the resizing subpatcher. The mechanism is explained in the comment lines.

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

piedagile's icon

Corrective of my above post: the pasted max patch opens in patching mode. So to try the solution go to the presentation mode and hide the toolbar before.

Simone Grande's icon

wow, thanks a lot for all this