Send bang with and without change in mousestate

Nov 7, 2013 at 9:20pm

Send bang with and without change in mousestate

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>

#270490
Nov 7, 2013 at 10:23pm

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>

#270494
Nov 7, 2013 at 10:57pm

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…

#270497
Nov 7, 2013 at 11:02pm

Ah….

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

<code>

– Pasted Max Patch, click to expand. –

</code>

#270499
Nov 7, 2013 at 11:14pm

great. good to know!

#270503

You must be logged in to reply to this topic.