Subclassing AsyncUpdater & MenuBarModel = fail


#1

My MainContentComponent subclasses both AsyncUpdater and MenuBarModel, and that is causing some errors for me when I compile.   it seems the compiler doesn't know where to look for triggerAsyncUpdate().  

 

What's the proper way to trigger it?   I'm using the famous JuceDemo code  everyone knows from the MidiDemo to trigger a repaint()

    struct IncomingMessageCallback   : public CallbackMessage
    {
        IncomingMessageCallback (MainContentComponent* mcc, const MidiMessage& m) {
            _mcc = mcc;
            message = m;
        }
        void messageCallback() override
        {
            if (_mcc != nullptr)
                _mcc->addMessageToList (message);
        }
        Component::SafePointer<MainContentComponent> _mcc;
        MidiMessage message;
    };

    void postMessageToList (const MidiMessage& message) {
        (new IncomingMessageCallback (this, message))->post();
    }

    void addMessageToList (const MidiMessage& message) {
        triggerAsyncUpdate();
    }

    void handleAsyncUpdate() override {
        this->repaint();
    }

 

The error I get is:

Non-static member 'triggerAsyncUpdate' found in multiple base-class subobjects of type 'juce::AsyncUpdater"

Do i need to make a separate component class for my MenuBar, add it as a child to this MainContentComponent to get around this? 


#2

bump!


#3

I did the easy thing, made a new component class that subclassed AsyncUpdater, and added that component as a child of my MainContentComponent, and moved the MenuBar object back into my MainContentComponent

 

I still would like to know the solution to this problem posted above. 


#4

I may be wrong but isn’t it required here to fully qualify your call “triggerAsyncUpdate” to resolve the ambiguity?


#5

I knew it was gonna be somethin' extremely simple!!

 

Thanks for clarifying!