Hi @danngreen Was this ever resolved? Somebody is asking me because they want to map a button to the button on my module.
Sorry, which button issue is this about?
mouse events and buttons
Ah, right. No I havenāt done anything to support mouse events.
ok cool thanks
I am updating my plugins with buttons to not use mouse events and instead use triggers in process method like how other things work.
Iām also interested in this for the kocmoc TRG module but Iām really not sure how you would get it done since Iām pretty lost with the UI side of VCV Rack.
My preliminary idea was to just replace the mouse event handling with transparent button widgets but Iām not at all sure if this would work with a custom display on top.
I tried to get the xy pad working (today). But there was no response at the outputs, no matter how I operated it.
Could this also be due to the mouse event? Ultimately, I canāt create any random shapes either.
I would like to create something like Enjoy Electronics - ELFO.
Great! Yeah Iām also curious how you do it
For the Fundamental Quantizer I did the easiest thing and ended up replacing the widget with actual buttons, but admittedly it looks bad compared to the original. I wanted to go back and make custom buttons with graphics that look more like the original, but never didā¦
Interesting⦠that might work if the button PNGs are the correct size but are only made of transparent pixels? Then the MM UI would see the buttons and highlight them properly. And I think an underlying graphic display would still work. Not 100% sure of this, but it sounds reasonableā¦
Hi, your plugins have been in my top 5 since day one and Grains is absolutely fantastic. Any chance it will be ported to the MM now that sampling is being supported? Thanks!
Following up on this idea of using transparent buttonsā¦
I tried it out on Impromptu, since it has mouse-based 12-note keyboard widgets.
I found this method works great. For the widget, you can just make a small PNG with only transparent pixels, e.g. 8x8:
struct InvisibleButton : app::SvgSwitch {
InvisibleButton() {
momentary = true;
addFrame(Svg::load(asset::plugin(pluginInstance, "res/comp/transparent8x8.svg")));
addFrame(Svg::load(asset::plugin(pluginInstance, "res/comp/transparent8x8.svg")));
}
};
I started off using this, but then realized all the Impromptu invisible widgets have LEDs in the spot where you would want to click, so I didnāt really need the custom widget. Instead, I used a non-transparent TL1105 widget (the LED covers the TL1105 completely). But either way is the same process.
Then I added the invisible buttons in the same way I would add a normal button param+widget to a VCV module:
Add new enums to the ParamIds enum (example)
enum ParamIds {
//... make sure to add these to end, not the beginning or middle
INVISIBLE_BUTTON1,
INVISIBLE_BUTTON2
};
Then configure it in the Module constructor (example):
configButton(INVISIBLE_BUTTON1, "Toggle Feature");
Then handle the button presses in Module::process(), more or less copying what the button widgetās onButton() function does (example).
if (params[INVISIBLE_BUTTON1].getValue() > 0.5) {
// handle button press
}
And finally, add the widget in the the ModuleWidget constructor, using the custom InvisibleButton class (example).
addParam(createParamCentered<InvisibleButton>(position, module, MyModule::INVISIBLE_BUTTON1));
Also, in firmware v2.1.11 coming out soon, I added support for buttons that donāt have SVGs, so you will be able to get rid of the 8x8 PNG and custom widget class, and just use rack::app::Switch instead. E.g. the Impromptu CV-Pad module (here) works with no modifications in that firmware