Forums > MaxMSP

Creating an object that responds to a click / double-click

November 8, 2012 | 1:49 pm

I quite like the way that a [loadbang] can be made to bang again later by double-clicking it.

How do I add this to my own object?

November 8, 2012 | 2:11 pm

one way with timer:

— Pasted Max Patch, click to expand. —
November 8, 2012 | 2:29 pm

Yes, I see what you’ve done.

But isn’t there a way of tapping into the operating systems double-click event? Rather than trying to recreate the event ourselves?

I like what you’ve done, but the double click is set to a fixed time, whereas in a operating system you define this time through your system-wide preferences.

November 8, 2012 | 2:31 pm

Also, your example shows how to respond to a double click within a patch.

I want to be able to double-click my own object – they same way you would double-click a [loadbang].

November 8, 2012 | 2:35 pm

Surely you are referring to external development? An abstraction would only open the patcher window, in which case I suppose [active] could work in a roundabout way.

I’ve not heard of a function that recognises double-clicking your external as a bang, but if you ask in DEV forum I’m sure someone will be able to help.

November 8, 2012 | 2:40 pm

mmm… if you want to detect dbl-clicking in a max patch, why not use loadbang?

— Pasted Max Patch, click to expand. —

… if you want a custom external to respond to double clicking, then you can implement the dblclick method – iirc, the index~ example should show it!


November 8, 2012 | 2:42 pm

I posted before seeing these replies. The way to access mouse data in max is via [mousestate], but you will still encounter the problem I mentioneddue to the difference between abstractions and objects

November 8, 2012 | 3:08 pm

goodparleyandorfing – you are right… double-clicking my own abstraction will cause the patch to open. I forgot about that. So I guess an external is the only way.

Thanks all.

November 8, 2012 | 8:23 pm


if you need to detect the ‘true’ double click (that is, the double-click that the OS will send you based on global settings about sensitiveness of the mouse etc) then you need to make an external. If you just want to ’emulate’ double-clik (that is: you set the threshold between subsequent clicks in Max), then you can use the following small example patch based on the [lcd] object:

— Pasted Max Patch, click to expand. —

Just double-click on the [metro] object in my example! It will turn the metro on. Oh, and don’t forget to set the threshold time in the ‘basic stuff’ part! ;-)

Hope this helps,

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

Forums > MaxMSP