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

Nov 8, 2012 at 1:49pm

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

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?

#65139
Nov 8, 2012 at 2:11pm

one way with timer:

– Pasted Max Patch, click to expand. –
#234799
Nov 8, 2012 at 2:29pm

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.

#234800
Nov 8, 2012 at 2:31pm

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

#234801
Nov 8, 2012 at 2:35pm

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.

#234802
Nov 8, 2012 at 2:40pm

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!

hth
aa

#234803
Nov 8, 2012 at 2:42pm

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

#234804
Nov 8, 2012 at 3:08pm

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.

#234805
Nov 8, 2012 at 8:23pm

Hi,

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,
Ádám

#234806

You must be logged in to reply to this topic.