How to set the patcher window size with JS
Apr 04 2014 | 7:46 am
- Apr 04 2014 | 8:47 amdo you want to adjust the overall window size??this.patcher.window( "size", x, y, x + w, y + h ) this.patcher.window( "exec" );??
- Apr 07 2014 | 7:01 pmHi Lee, Thanks for your answer, this is exactly what I needed to know. If you don't mind though, can you help me understand how you did that? In the documentation I do not see anything for the "size" attribute of this.patcher.window and I do not see anything for "exec" either. It seems like a new way to send messages to objectsIn fact, I really don't see any documentation for this.patcher.window at all, so I don't get how to message it.Also, now that I know how to change the size / placement of the patcher window with js, could you help me change the size and placement of the patcher window when it is in presentation mode (if these can be changed individually)?One issue is that, in the patcher inspector, certain properties are just not listed.
var mess = this.patcher.getnamed("message"); var b = mess.getattr("bgcolor"); post(b);will print the background color of a message box, but the bgcolor attribute doesn't even exist for this.patcher.windowFurther, trying to get an attribute that is listed for a patcher object, does not work. i.e.
var c = this.patcher.window.getattr("openrect"); post(c);Thank you very, very much.
- Apr 07 2014 | 8:55 pmHi sure - alot of the documentation for thispatcher is in the thispatcher object. if you ALT-click on a thispatcher object or navigate to it in help menu, you'll see a section at the bottom "double-click to see more features" - this contains lots of other info - for example, the first subpatch shows you all the window commands you can send to set flags, position etc.the window position is for the window - it cannot be set (as far as I know) separately for presentation and patching...i find this part of the doc probably most confusing of all - windows, patchers and the cross-over into js - takes alot of experimentation and playing around...not really had occasion to use getattr so don't really know much about it.... might have a play...
- Sep 21 2021 | 12:15 amI know this is an old thread. But I was drawn to it and found it useful. And I can now provide some additional information. The following is based on Max 8, which was released subsequent to the previous posts in this thread. Not having used previous versions, my guess is that some or all of the following is new since those previous posts.Startec wrote:
I really don't see any documentation for this.patcher.window at all, so I don't get how to message it.I have found one passage of documentation that, though it does not discuss patcher.window specifically, is relevant. It's brief, so I shall quote it in full. In the "The Patcher Object" documentation page in Max Reference, it says:
Patcher Methods Overview
this.patcher.window("size", x, y, x + w, y + h); this.patcher.window("exec");is
this.patcher.wind.location = [x, y, x + w, y + h];(Note the improved term location compared with the misnomer size. Wind does have a size property too. But it's used strictly for getting or setting a window's size, without reporting or changing the window's location/position, as specified by its top left corner.)But I cannot find a way to maximise a window using Wind. With window, it's
this.patcher.window("zoom", 1); this.patcher.window("exec");Conversely, I cannot find a way to get a window's position and size with window. With Wind, it's
location1 = this.patcher.wind.location; outlet(0, [location1, location1, location1, location1]);