Multiple windows events GUI

Hello, I am building an app with two windows, following the template of examples/window/multiwindowExample. In the app containing, among the other things, the GUI, I need to send an event to the ofApp.

What I am doing at the moment is:

main.cpp

#include "ofMain.h"
#include "ofApp.h"
#include "Editor.h"
//#include "ofAppGLFWWindow.h"

int main( ){    
    ofGLFWWindowSettings settings;

    settings.setSize(1400, 700);
    settings.setGLVersion(3, 2);
    settings.setPosition(ofVec2f(300,0));
    settings.resizable = true;
    shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

    settings.setSize(300, 300);
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = false;
    shared_ptr<ofAppBaseWindow> editorWindow = ofCreateWindow(settings);

    shared_ptr<ofApp> mainApp(new ofApp);
    shared_ptr<Editor> editor(new Editor);
    mainApp->editor = editor;

    ofRunApp(editorWindow, editor);
    ofRunApp(mainWindow, mainApp);
    ofRunMainLoop();
}

Editor.cpp

#include "Editor.h"

void Editor::setup(){
    parameters.setName("parameters");
    gui.setup();
    //gui.add(cube.params);
    gui.add(generateButton.setup("setup"));
    ofBackground(0);
    ofSetVerticalSync(false);
}

void Editor::update(){

}

void Editor::draw(){
    gui.draw();
}

ofApp.cpp, partial

void ofApp::setup(){
    editor.generateButton.addListener(this, &ofApp::generateButtonPressed);
....
}

ofApp.h

#pragma once

#include "ofMain.h"
#include "Editor.h"

class ofApp : public ofBaseApp{

	public:
		void setup();
		void update();
		void draw();

        void generateButtonPressed();

		void keyPressed(int key);
		void keyReleased(int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		void mouseEntered(int x, int y);
		void mouseExited(int x, int y);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);


    shared_ptr<Editor> editor;

};

And the error that I am receving is:

“/home/dapx/Documents/of_v0.10.0_linux64gcc5_release/apps/myApps/orthopattern/src/ofApp.cpp:5: error: ‘class std::shared_ptr’ has no member named ‘generateButton’
editor.generateButton.addListener(this, &ofApp::generateButtonPressed);
^”

Any idea?

can you post Editor.h that’s where the problem seems to be i guess

Editor.h

#pragma once

#include "ofMain.h"
#include "ofxGui.h"

class Editor: public ofBaseApp {
public:
    void setup();
    void update();
    void draw();

    ofParameterGroup parameters;
    ofxPanel gui;
    ofxButton generateButton;
};

I also need to share textures created in the editor with the main app. I assume I should simply call settings.shareContextWith = mainWindow; in the main.cpp file. Is this correct?

settings.shareContextWith = mainWindow;
shared_ptr<ofAppBaseWindow> editorWindow = ofCreateWindow(settings);

The problem is, that editor is a shared pointer, if I use:
editor->generateButton.addListener(this, &ofApp::generateButtonPressed);
It works