Forums > MaxMSP

Cursor change with roll overs and dragging

July 30, 2013 | 7:40 am

I am building functionality at work that requires cursor changes and roll over states for objects / images.

Is there a way to change the mouse cursor while rolled over a button or image that is not a pict solution (maybe using the OS standard mouse cursors)?

Also, is there a way for the mouse to remain shown while dragging on a slider or gain object? I know this functionality was removed in version 6.0.7, but was wondering if there was a way to override this functionality attaching a pict object to the mouse position.

July 30, 2013 | 8:57 am

[mousestate] and an [fpic] should do it, because you can send the [mousestate] coordinates to the [fpic] patching_rect and/or presentation_rect attribute. You’ll probably need to tweak the values a bit to center the image where the cursor is.

August 1, 2013 | 3:19 pm

Understood and thanks for the response. I have set up an example using your suggestion above, but I believe I am not completely understanding how to access values in message objects (and that’s under the impression a message object is required).

Attached is an image of my current progress. I am trying to store the x and y values in a [pack] and sending the list to be unpacked so the [pict] presentation_rect can be set, but cannot access each element in the [pack] object. I am not sure how to access the individual list elements.

Thanks in advance.

  1. CursorController-patch

August 2, 2013 | 12:42 am

Here’s my 2-minute attempt. It’s not that graceful, and keep in mind that the ‘presentation_rect’ message gives coordinates for your patcher’s window, not your overall screen, so maybe offset it with window information from [thispatcher]:

– Pasted Max Patch, click to expand. –

EDIT: I just swapped my [metro] for [mousestate]‘s own ‘poll’ message.

August 2, 2013 | 12:58 am

This bugged me, so I put in the offset from [thispatcher]. It’s probably computationally expensive for what is is though!

EDIT: removed pointless patch.

August 2, 2013 | 1:02 am

aaaaaaannnnndddd I’ve jut seen [mousestate] can do that on its own with a ‘mode 1′ message. This is why I usually avoid the forums before my morning coffee!

August 2, 2013 | 9:00 am

Lol I hear you. Need to grab my cup of coffee. Thanks for the nice fix. The [pak] object is very nice. Thought the pack object would function the same.

The reason I am doing this is cause we want mouse states for buttons, images, sliders, etc. And really what this came from was the fact that the mouse cursor is hidden while dragging sliders and gains. I tried ‘;max showcursor’ while dragging but it did not work.

Thanks again for the help.

August 14, 2013 | 1:16 pm

A new issue has arised.

I created a custom cursor (e.g. a [pict] object) which follows the mouse pointer. It is blocking a hover call and not running my code for swapping images when hovered over.

– Pasted Max Patch, click to expand. –

If you move the mouse fast over the button, you will see the button flicker.

Is there a way to fix this or tell Max to ignore the image under the mouse position?

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