Send bang with and without change in mousestate

whorl's icon

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?

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks a lot for any help!

12root2's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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.

whorl's icon

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

whorl's icon

Ah....

Max Patch
Copy patch and select New From Clipboard in Max.

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

12root2's icon

great. good to know!