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

Aug 12, 2010 at 3:29pm

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

Hi,
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 ?
thanks,

#51760
Aug 12, 2010 at 4:36pm

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 ;-)

#185721
Aug 12, 2010 at 6:52pm

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 ?

#185722
Aug 13, 2010 at 5:48am

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 …

http://www.olilarkin.co.uk/index.php?p=max

#185723
Aug 13, 2010 at 7:17am

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.

#185724
Aug 13, 2010 at 7:44am

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..

#185725
Aug 13, 2010 at 9:47am

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. –
#185726
Aug 13, 2010 at 4:18pm

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)

Thanks,

P.S:
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.

#185727
Aug 13, 2010 at 5:05pm

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 ?

#185728
Aug 14, 2010 at 2:09pm

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 …”

+1

HTH.

#185729
Aug 14, 2010 at 2:10pm

oops ; (mac only with sources).

Attachments:
  1. Quebec.zip
#185730
Aug 17, 2010 at 11:16am

Well, thanks for this external pizza olives !

#185731

yas
Aug 17, 2010 at 12:20pm

what about using [hi]?

#185732
Aug 17, 2010 at 1:32pm

> what about using [hi]?

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

#185733
Aug 31, 2010 at 5:58pm

Hi,
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,
Philippe.

#185734
Sep 1, 2010 at 10:41am

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 …

#185735
Sep 2, 2010 at 3:50pm

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 !

#185736
Sep 3, 2010 at 8:57am

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 !

#185737
Oct 5, 2010 at 4:13am

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.

#185738
Oct 5, 2010 at 6:20am

Hello maxers,

just to say you can find here last version of [quebec] with lock/unlock state report : http://cycling74.com/forums/topic.php?id=28701

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

#185739

You must be logged in to reply to this topic.