Preset browser double click
-
I'm using the broadcaster to check if the user double clicks a preset. The idea is I want to load the preset and close the browser on double click, but keep the browser open on single click.
However the double click doesn't work reliably because it's loading the preset twice.
I had a look in the source and can see the
doubleClick
parameter of theselectionChanged
function is commented out. I uncommented and also added a check for the number of clicks in this section.if (listener != nullptr && !e.mouseWasDraggedSinceMouseDown()) listener->selectionChanged(index, row, entries[row], e.getNumberOfClicks() == 2);
But it's like it just sees it as two single clicks and no double click is coming through.
@Christoph-Hart Any hints?
-
@Christoph-Hart I saw the broadcasters were getting some love today. Any suggestions for this one?
-
@d-healey I am using double click preset browser in my plugin this works for me:
const var presetBrowserWatcher = Engine.createBroadcaster({ "id": "presetBrowserOnClickStatus", "args": ["component", "event"] }); presetBrowserWatcher.attachToComponentMouseEvents("FloatingTile2", "All Callbacks", "Mouse Listener for PresetBrowser"); presetBrowserWatcher.addListener("RefreshFunction", "Delays the closing of the Preset Browser",function(component, event) { if(event.doubleClick) { // close the presetbrowser } });
This is just copied from my project, there is room for improvement instead of using All Callbacks we should be using only mouse clicks.
-
@oskarsh Doesn't that trigger a double loading of the preset?
-
- maybe in the single click check the time since last click to find if its actually a double click?
-
@d-healey unfortunately yes, in my case this did not produce any issues since the presets are loaded quickly. But I can see how this could become an problem for larger plugins.
-
@oskarsh Yeah I'm loading samples with the preset, but I think you've given me an idea. I could simply check if the new preset is the same as the last preset, and if it is I skip loading the samples again. I'll let you know how I get on.
-
It will work :) I'm going to combine it with Lindon's timer idea because I also have a pre-loading screen that pops up and prevents the second click being registered, a time will solve that.