window size is driving me nuts!

Mar 23, 2010 at 8:16pm

window size is driving me nuts!

I have a large patcher window that needs to open to 1064×690 on both Mac and Windows (XP, Vista, and 7). Given that all of those platforms have different amounts of workarea because of their various menubars, windowframes, taskbars, etc., I’m trying to create some flexibility. Here are the things I need to have happen.

1. Window opens to 1064 x 690 BUT not at a predetermined location
2. User can make the window smaller than 1064×690, but not larger
3. If monitor resolution is larger than the window, the window fully opens to its fixed size of 1064×690 with no scroll bars
4. If monitor resolution is smaller than the window, the window fully opens, but with scroll bars

When I try to do this, these are the issues I run into.

1. I can make the window open to a fixed size with the window size message to [thispatcher] but that requires me to set the window location. Is it possible to just set the window size without setting the coordinates?
2. If I use the window constrain function, it always adds scroll bars to the patcher even if there is plenty of room on the desktop because it includes the width of the title bar in the measurement. I can offset the constrain value by the width of the title bar, but then I need to know the title bar’s width and it is different on all the platforms.

Please take a look at this patcher for details.

– Pasted Max Patch, click to expand. –
#49310
Mar 23, 2010 at 9:09pm

I think what we need is an “inside dimension” size and/or constrain function that just measures the patcher stuff and not the surrounding window stuff.

#177183
Mar 24, 2010 at 1:23pm

You can first ask where a window is with the get size message and then adapt your size message according to this info… The screensize object will give you the screensize, and you can also find out if you are running on a Mac or on Windows with a message to Max. All the info you need to calculate it correctly is there…

– Pasted Max Patch, click to expand. –
#177184
Mar 24, 2010 at 3:35pm

Hi Stefan, thanks for your reply. I’m already doing all that. I didn’t include the screensize and check for Mac/Windows parts in the patch above, but they’re in the one I’m building. The problem is even if I detect whether they are on Windows or Mac, I run into the fact that on Windows–depending on which flavor of Windows they are running–the titlebar, taskbar, window frame, etc. are all different sizes. The “window size” message to [thispatcher] seems to work with inside dimensions, while the “window constrain” message seems to work with outside dimensions. Since those outside dimensions change with each OS version on Windows, I can’t put my finger on a way to do what I’m trying to do.

The problem is compounded by the fact that the window is kind of large, and is too large for people with 1024×768 or smaller monitors. I can get everything to work for the folks on larger monitors, it’s the ones with the smaller resolution that pose a problem. If I do a fixed window size, it often puts the scroll bars off screen.

Oh well, I may need to rethink my whole window size approach on this one.

#177185

You must be logged in to reply to this topic.