Cursor change with roll overs and dragging

Jul 30, 2013 at 7:40am

Cursor change with roll overs and dragging

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.

#257596
Jul 30, 2013 at 8:57am

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

#257607
Aug 1, 2013 at 3:19pm

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.

Attachments:
  1. CursorController-patch
#257808
Aug 2, 2013 at 12:42am

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.

#257828
Aug 2, 2013 at 12:58am

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.

#257829
Aug 2, 2013 at 1:02am

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!

#257830
Aug 2, 2013 at 9:00am

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.

#257868
Aug 14, 2013 at 1:16pm

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?

#258904

You must be logged in to reply to this topic.