Pop Up Window - resize and remember
Hi guys,
I've created a patch which involves a 'display' pop up window.
I would like people to be able to resize and move the pop up window to their needs and the pop up window then REMEMBER it's size and position for when it's re-opened within the Ableton project it's being used in.
Ideally the 'resize' would just happen by mouse dragging the corners of the window..
Any ideas on how to do this?
Thanks a million!
thispatcher object is the one to use for manipulating window size and position.
If it was only max, I would just store the screen coordinates to disk as text file,
and read it before openning the window.
In case of Live, which I don't use, maybe You could store the values
as parameters ..??..
------
Anyway check windowmessages page in help file...
After user adjusts the screen, one could get the screen coordinates with message window getsize
and store 4 values, for example 20 100 300 400
windowsize $1 $2 $3 $4, window exec
to recall it...
Thanks for your input!
So I would have a message with window resize going into my pattrstorage?
and then the windowsize $1 $2 $3 $4, window exec with a loadbang into my this patcher?
Sorry, I'm fairly new to max...
Thank you for your patience with my silly questions...
Did You have a look at thispatcher help file ?
And window mesages ?
In short , when asking this patcher to output current window size,
it gives You 4 numbers, like 20 50 200 200 as a list.
They are representing left, top, right and bottom coordinates.
You can store this as a list, and recall the list and send via
windowsize $1 $2 $3 $4, window exec
message to thispatcher.
$1 $2 $3 $4 is just teling the message to output 4 incoming numbers
together with the rest of the message.
Thispatcher object must be in the root of the "Dialog"
popup window, but storage can be in the main patcher.
I don't use Live, You have to find the simplest way to store the 4 numbers,
if Live can't store a list as a parameter, You can simply unpack the list
into 4 int boxes or whatever for storage, and pack it into list again on recalling.
-----------
Finally, Live should recall the list on project load, so in theory,
there should be no need for loadbang, but to make sure
I would bang the stored 4 numbers short before one opens the dialog.
I guess You are using pcontrol to open the patcher.
So just send 4 numbers, and trigger open 100 ms later...
You have a few mistakes in there.
As first - a floating window does not prevent user from closing it,
so Open/Close button in main patcher is usseless.
If You want to use that button, then You must set nocolse flag too,
and put Open button in main patcher, and Close button in popup window itself.
If noclose and float set window covers the Open/Close button in main patcher,
You won't be able to click on the button and close the window, that is clear right ?
Here is the patch :
On every closebang window coordinates get set into pattr.
If one does not move or resize the window, it remains as last stored.
Thanks so much for this! I'll have a look into it now.
Regarding the button, I wanted this ONE button open and close the pop up window - which actually worked fine. I'll have another look at that too though!
Thanks a million for your time!
So - I've just tried your patch and it has the same problem as mine. The window size and position is NOT remembered when re-loading the Ableton project but the window opens in it's default position again.
What I would like to achieve is that the user can adjust the size and position, save the Ableton project and then have the adjusted size and position recalled the next time he opens the Ableton and the project...
Your problem is not max patch but ableton.
You should find a way that this 4 numbers get stored and recalled
when project is saved, or loaded.
So get Your way arround pattr autopatr or whatever.
As I said, I have no interest in Live at all, so can't help You with that.
I have not included any of that in the patch, I left it to You.
Max Patch is working allright, if You want to check just store pattrstorage file and
read it in, bang the pattr screen and You'll get the 4 values out.
Hi,
I didn't mean any disrespect at all - very much appreciate your time and input!
I'm mainly confused as Ableton DOES remember the font size, colour and background colour with saving the project but for some reason i can't get it to also remember the window size.
Why remember half the information?!
I'm just frustrated.
Thanks again :)
I am sorry You can't get that to work.
Can You not store that 4 numbers in pattrstorage with project ?
It must be a trivial thing to do so.
Also to send them to the message with window size on Project load..
I would try something simple to check the way Live stores pattr etc.
The patch I posted works as it should, when You close the window,
reopenning the window will use last coordinates, and the 4 numbers
are in the Pattr.
So just connect output of pattr screen to the message containing 4 numbers
to recall it
Thank you.
The amount of hours I'm spending on this is getting ridiculous. I'm sure it's just a tiny little problem - as you said!
I've now put storage window onto the pattrstorage to see what's happening. While pattr seems to record the initial values, it doesn't update them when closing the pop up...

Could it be that closebang is not working properly in Live ?
It does in max. You can see it in the message with 4 ints.
If that is a problem, You could use Close Button in Popup window
to first triger window getsize, and then after a short delay close the window
If The pattr as such is a problem here is a variant using multislider to
store the 4 values.
Check it with inspector for init enable and init values.
I don't know if that conflicts with the stored parameters in Live Project.
I had tried the version with triggering the getsize and a delay already as well. Didn't make a difference...
BUT
The multislider idea works A TREAT!!
Amazing!! Thank you so so much!
Finally, glad that it works.
It must have been something to do with Live and pattr etc...
As I don't use Live , I had no way to help You with that,
I just thought at the end that UI object like multislider would be better integrated
into Parameter automation.