Forums > MaxMSP

Send bang with and without change in mousestate

November 7, 2013 | 9:20 pm

Hi there,

Another undoubtably simple problem, but one which i’ve searched the forums and can’t work out.

I’m trying to hide the cursor when it moves over an LCD. When it leaves the LCD I want it to reappear. To do this i’m trying to connect the mouse X, Y to the (; max hidecursor) and (; max showcursor) commands. So, when there is any movement in either the X or Y cords I want to send a bang to the (hidecursor) and when there is no movement in either I want to send a bang to the (showcursor). The former is easy enough, but what is a good way to send a bang from no change?

Thanks a lot for any help!

<code>

– Pasted Max Patch, click to expand. –

</code>


November 7, 2013 | 10:23 pm

If the LCD object suppose to remain in its place, you can use mousestate to find the borders of it, and define the 2 areas using and && object. See an example attached (the coordinates are specified within the comparison objects, and are depending on your screen resolution)
But I don’t know a way to make it global (so it can be used on other screens), because the "patcher_rectangle" attribute, which tells you the object location and size in the inspector, cannot be accessed with a "get" message or such.
Another idea is to use the LCD border coordinates to determine when you’re about to leave its area, but unfortunately the polling of the mouse position is quite slow.

<code>

– Pasted Max Patch, click to expand. –

</code>


November 7, 2013 | 10:57 pm

Hey thanks a lot. Yeah, I initially wanted to use the mouse position within the LCD as the trigger but the polling is just too slow.

The mousestate option is problematic as the LCD wont be in the same place.

Hmmm…


November 7, 2013 | 11:02 pm

Ah….

A simple mode 1 command makes the mousestate relative to the patcher.

<code>

– Pasted Max Patch, click to expand. –

</code>


November 7, 2013 | 11:14 pm

great. good to know!


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