CustomControlSurface mapping issue

Hi,
I’m using the CustomControlSurface and all other stuffs like ExternalControllerManager ecc… to create a custom control surface and map the incoming midi messages to application functions.
The problem is :
To map the incoming messagges to functions i’m using the showMappingsListForRow(rowNumber) and listenToRow(rowNumber) methods to create a map between a control change and the play function ( for example ).
This works very well but if i create 2 maps ( so the total mapping size is 2 ) and i want to change the previous map ( the one in the first position of the mappings array ) i just cannot do it because in the handleAsyncUpdate() of CustomControlChange map there are those line of codes :

 CRASH_TRACER
    sendChangeMessage();

    if (listeningOnRow >= 0 && listeningOnRow == mappings.size())
        setLearntParam (true);

So if i put the first row in the learning state again the setLearntParam (true); won’t be called because this condition listeningOnRow == mappings.size() will just return false.
Any hints ?

You can call setLearntParam(false) yourself whenever you want to apply the mapping. In our UI code we call it whenever the selected row changes, enter is pressed or the dialog closes.

    void listBoxItemClicked (int row, const MouseEvent& e) override
    {
        owner.setLearntParam (false);
        
        if (e.x > box.getWidth() / 2)
            owner.showMappingsListForRow (row);
        else
            owner.listenToRow (row);
    }

    void deleteKeyPressed (int lastRowSelected) override
    {
        owner.setLearntParam (false);

        owner.removeMapping (lastRowSelected);
        box.updateContent();
    }

    void returnKeyPressed (int) override
    {
        owner.setLearntParam (false);
    }

    void selectedRowsChanged (int) override
    {
        owner.setLearntParam (false);
    }

thank for your quick replay, it works! :slight_smile: