Help me with Switch+knob combination

hi. i hope you are fine.

I am stuck. I want to create a switch+knob combo. I am using a 2 matrix containers to build it.
here is the logic:

  1. if switch is turned off, knob will not send any midi message (but you can change the knob value for later use)
  2. when switch is turned on, the current value of the knob will be sent through Midi
  3. if switch is turned on, rotating the knob will send midi message.
  4. when switch is turned off, the knob will not go to 0, instead it will keep showing its value.

use cases: i want to turn an effect on/off, and modify the amount of the effect.

currently using logic:

  1. when switch is turned off, knob "bypass" prop is "true". (works)
  2. value is not updated when i change the knob. it somehow goes to "default"...? (need help)
  3. opposite of 1. (works)
  4. turning off switch makes the knob go to 0. (need help)

also, if you have any better way of implementing this/similar things, please let me know

here is the project file

I don't recommend linking matrices like this, it's just too complicated to get everything right this way. Here is an example of the recommended pattern:
ButtonKnobCombo.json (6.9 KB)

The idea is to create a "template" widget (here a button + knob combo) that encapsulates the logic you want and then duplicate it using a clone matrix. Children of the template widget all use variables that are overridden by the matrix.

If you want to hide the template widget, set its visible property to false and add "visible": true, before "variable": in the matrix' props.

OMG this so so much better!
you are awesome, thank you so much <3 !