Forums > MaxMSP

thispatcher and mousestate : when is my patcher window size changed ?

August 12, 2010 | 3:29 pm

I just wanted to find a simple way to know exactly when my patcher window size is changed, in order to resize the lcd that is in it.
I need to test the window size (with the msg "window getsize" sended to [thispatcher]) when the mouse button is released, but [mousestate] doesn’t report the button events when i click on the window zoom corner, or the titlebar, or elsewhere outside a patcher. It looks like [mousestate] only report the button pressed when I click inside one of the patchers opened.

How can i do ?
Any other way to get the new window coordinates when changed ?

August 12, 2010 | 4:36 pm

Hello Alexandre,

is that work on your computer ?

– Pasted Max Patch, click to expand. –

curious ; i still don’t understand how is it working on mine ;-)

August 12, 2010 | 6:52 pm

Well, thanks, this way of doing is also working here. But your way of doing is fine until you a bit more of your cpu… i don’t want to resize the lcd every 25 ms for nothing, with my sound going on…

So what i want is the state of the mouse BUTTON, the 1st outlet of [mousestate], which do not work while clicking somewhere else than inside the max patcher. This 1st outlet of [mousestate] is doing nothing when i grow the window.
Is’nt there a way to get the mouse buttons info when the mouse click outside max ?

August 13, 2010 | 5:48 am

Hello Alexandre,

I have not benchmark the process ; but IMHO you don’t have to care about just one [moustate] one [delay] and one [trigger] even if you are banging them every 25 ms …

if you really care about CPU don’t use [lcd] ;-)

Anyway : perhaps [ol.mousewheel] from Oli Larkin ? my memory is not good ; but i think you can track mouse click with it …

August 13, 2010 | 7:17 am

about the cpu, i don’t care about [mousestate] every 25ms, but about the "window getsize" msg sended to [thispatcher] every 25ms, (msg to test if the window size have changed), plus i just don’t like this way of programming, to have useless messages sended everytime, everywhere, after it’s a mess, and then your sound is not working right, and you can’t figure out why…

I feel something might be missing in [thispatcher], it would have been nice that it output some msg when the window size is modified.

Anyway, i’m sending "window getsize" every 1000ms (and only while my sound is off), not elegant, but working.

Thanks for the Oli Larkin’s external notice, I remember i tried this and it was working before on my MBP, but now it’s not. strange.

August 13, 2010 | 7:44 am

Guess, you know what ?
After an hour of sending "window getsize" every second to [thispatcher], the "save" button in mac os window started to "twinkle", and some part of the mac os saving window too!… so i stopped this "window getsize", and guess what, suddenly my system is not twinkling anymore…

This "window getsize" every second is clearly not a solution.
I don’t find any solution..

August 13, 2010 | 9:47 am

Hello Alexandre,

oops : i have a look on [ol.mousewheel] ; it doesn’t track click button …

"… but about the "window getsize" msg sended to [thispatcher] every 25ms …"

on my computer, it bangs ONLY when you resize the window …

– Pasted Max Patch, click to expand. –

How it works :

– Pasted Max Patch, click to expand. –

August 13, 2010 | 4:18 pm

Wow, that’s a f*** weird way of doing, and it seem to work!.. But the problem again is that when lot’s of audio and drawing is going to be on, plus when i’ll share my patch with a friend on an other computer, then your 80 ms limit on your last patch will not react the same way, and then, either my lcd wont resize, or this "window getsize" is going to be sent all the time. And I’m not gonna spend my time adjusting this delay, just for a resize option that i will use episodically.

Anyway, I even didn’t think about using [active], and as my LCDs are mostly for display only, what i will do is to bring another patcher window to front after 5 seconds… ("window getsize" sent every second during theses 5 seconds)


I want to say again,
as feature request,
(anyone at C74 working in august and reading this?),
that it would be really welcome that [thispatcher] output some msg when the patcher window size have been modified.

August 13, 2010 | 5:05 pm

Hello Alexandre,

you are right, it’s a little bit bizarre and not very fun if you want to share patches ; and that’s true it should be nice to have an external doing that … maybe something to do ;-)

Hey, nobody have done it before ?

August 14, 2010 | 2:09 pm

Hello Alexandre,

i did it quickly ; i hope there is no bug ; waiting for cycling74 …

"… that it would be really welcome that [thispatcher] output some msg when the patcher window size have been modified …"



August 14, 2010 | 2:10 pm

oops ; (mac only with sources).


August 17, 2010 | 11:16 am

Well, thanks for this external pizza olives !

August 17, 2010 | 12:20 pm

what about using [hi]?

August 17, 2010 | 1:32 pm

> what about using [hi]?

i tried [hi] but it does not output anything from my Spyker mouse.

August 31, 2010 | 5:58 pm

Thanks Pizza Olives for the object. Works well!
Do you think that there is a way to know when the window has been moved?
I want to be able to store the new position only in this case.
A dedicated object would be great.

For cycling guis, here is another wish for christmas…
Many thanks,

September 1, 2010 | 10:41 am

Hello Philippe,

knowing when the window have moved isn’t so easy to code ;
i had a quick look this morning : no idea how to do it, sorry ;
i’ll ask in the "Dev" forum maybe …

September 2, 2010 | 3:50 pm

Hello Philippe,

ok, so after few investigations it seems not possible with SDK ; so maybe just ask window size to [thispatcher] when you close the window with [closebang] or [freebang] (or maybe [active]) if you don’t want to connect directly a [metro] to it … i think that most of time native object are best to use for crashproof optimizations.

Kenavo !

September 3, 2010 | 8:57 am

Hi Pizza olives,
Yes, in fact… I saw the discussion with Emmanuel on the DEV forum!
Getting the window size with [closebang] or even [freebang], is sometime to late in order to write the window position in a file. [Active] can be a solution but not in all the cases… And [metro] is really not the good choice to spy a window position.
A dynamic [thispatcher] would really be a good solution for us…
Anyway, thanks a lot for your investigations!
Keep the good work,
adessiatz, a reveire !

October 5, 2010 | 4:13 am

I’m curious if anyone has produced a similar object as pizza olives, but for Windows. If so, would you mind sharing? Sending the window getsize message every second is very clumsy and has a noticeable (albeit quite small) CPU impact.

October 5, 2010 | 6:20 am

Hello maxers,

just to say you can find here last version of [quebec] with lock/unlock state report :

anyway in both version i include C code sources ; a volunteer for windows compile ;-)

Viewing 20 posts - 1 through 20 (of 20 total)