Cable drag events

I’m thinking about adding CV inputs that replace the knob they override to my For Four module.

I suspect that adding a custom handler for whatever event handles the enabling / disabling of input or output ports when a cable is being dragged is the best way to implement it.

When an input cable is being dragged, hide the knobs and show the ports, when drag ends any that aren’t connected rehide the port and show the knob.

I’m not sure what to search for to find the current event implementation in src. Is there a way for me to hook into that event to implement this?

You’re already off here. CV input voltages add to parameter values, not replace them.

If it is for compactness of the layout you could try stack the port upon the knob. Might take a little bit bigger knob to make it work well. You could make the ports visually smaller by removing the outer ring. It’s on my to-do list but I’m slow with these things, so I do not know at what mouse pointer distance what is influenced.

Fundamental knobs with smaller ports,


I’ve a module in progress that does that, works fine.


1 Like

have you tried what the minimum workable knob size is?

So long as the knob is bigger than the port that sits on top of it, so you’ve something to ‘grab’ with the mouse pointer, it works.


Whatever box.size the component has will be the drag radius

I meant specifically my modules implementation rather than in general. I’m fairly sure I’ve used modules that work how you describe, ones that change the knob from a level to an attentuation and ones that ignore the knob when a cable is connected.

Mine falls in this last group as the input in question is a binary pattern select, not a level. I just wanted to add the graphic swap so it’s like having 25 versions of the module that autoswitch depending on the cabling.

It’s partly for size, but mostly for clarity - if a knob isn’t going to do anything, I don’t want to see it :slight_smile:

I found what I was looking for in PortWidget::Draw

Here’s how I’ve implemented it.

struct OptionalInput : app::SvgPort {
        OptionalInput() {

        void step() {
            if (!module)

            CableWidget* cw = APP->scene->rack->incompleteCable;
            if (cw) {
                    if (cw->outputPort)
            } else if (module->inputs[portId].isConnected()){
            } else {