# Pattern for using DynamicTextDisplay with VCV based MM plugins

**URL:** <https://forum.4ms.info/t/pattern-for-using-dynamictextdisplay-with-vcv-based-mm-plugins/317>\
**Category:** Plugin Development\
**Created:** [September 12, 2024, 8:16pm UTC](https://forum.4ms.info/t/pattern-for-using-dynamictextdisplay-with-vcv-based-mm-plugins/317 "2024-09-12T20:16:45Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![hemmer](https://forum.4ms.info/user_avatar/forum.4ms.info/hemmer/32/41_2.png) [@hemmer](https://forum.4ms.info/u/hemmer)\
**Post date:** [September 22, 2024, 4:34pm UTC](https://forum.4ms.info/t/pattern-for-using-dynamictextdisplay-with-vcv-based-mm-plugins/317/5 "2024-09-22T16:34:55Z")

</div>

Thanks for the detailed feedback, and happy to be a guinea pig for iterating towards useful VCV plugin centric API elements! It will take me a bit longer than it would you, but actually it’s be very useful for me learning the codebase, setting up debugging etc etc. And worth getting these things right. 😃

> [@danngreen](#):
>
> The MetaModuleDisplay widget type and the ModuleWidget handler for it look good. It’s definitely the right direction. I would suggest putting `MetaModuleDisplay` in the `MetaModule` namespace instead of the `rack::widget` namespace. Maybe it needs to change its name in that case, too (`MetaModule::VCVDisplay`? or `MetaModule::VCVTextDisplay`?) Also probably should put the file in `include/metamodule` instead of mixing in with rack file (thinking ahead for future Rack API updates…).

Yes that all sounds sensible, it’s awkward where it is.

> [@danngreen](#):
>
> Regarding the AltParamMomentary: we need a clear interface for VCV-ports to create AltParams easily, I appreciate you making headway on this.  
> It looks like how you have it, a module would set `visible = false` and that would make it an AltParam (at least for a momentary SvgSwitch). Could this backfire if there was a VCV module that had a switch that was sometimes hidden and sometimes visible when used on VCV?

I think the only time `visible` state currently persists is in the Widget constructor when the adaptor is doing a pass, so shouldn’t really change in theory. Example where it does are e.g. when muxlicer changes from 8to1 to 1to8 (so inputs/outputs are hidden/shown), but this is part of the rack ui `draw` which doesn’t get called at present. **However** , to be honest the mechanism in the PR isn’t very “discoverable” so some explicit interface for VCV-ports is better I think. I’ll give it some thought.

> [@danngreen](#):
>
> Back to the Noise Plethora: I understand now what you mean about adding the `hidden` flag to BaseElement! It makes sense, or probably adding it to `ImageElement` actually. So, if we added that, then we’d just have the redraw() functions return early if that flag is set. Default value is false, and that’s probably an easy way to handle this.

I can see that working, however again the only meaningful place `visible` state can change is in the UI thread (i.e. `draw`, which is currently [no-op](https://github.com/4ms/metamodule-rack-interface/blob/5ad07b95ced5069a3d38b26be82daf865e075862/include/app/ModuleWidget.hpp#L130)).

> [@danngreen](#):
>
> Another idea (I’m on a roll…), you could make the bank and section params be normal momentary button parameters, but just have their PNG be fully transparent. The XY position could be over the bank/section lights, so it looks right when highlighted in the ModuleView. Then they would be “invisible” but would be shown next to the encoder parameter in the element list.

This is a great idea, and works well 🙂 It actually invalidates the need for AltParamMomentary in this instance, though I can still see that being generically useful.

---

_[View the full topic](https://forum.4ms.info/t/pattern-for-using-dynamictextdisplay-with-vcv-based-mm-plugins/317)._
