main.cpp
#include "testingUI.h"
#include <wx/wx.h>
#include "wxTestingApp.h"
#include "wxTestingMain.h"
int main( int argc, char** argv )
{
     wxApp :: CheckBuildOptions( WX_BUILD_OPTIONS_SIGNATURE, "testingUI" );
     wxTestingApp app;
     wxTestingFrame* frame = new wxTestingFrame( nullptr );
     if( app.OnInit())
     {
          frame -> Show( true );
          return app.MainLoop();
     }
     return 0;
}
testingUI.cpp
#include "testingUI.h"
testingUI::testingUI()
{
     //ctor
}
testingUI::~testingUI()
{
     //dtor
}
testingUI.h
#ifndef TESTINGUI_H
#define TESTINGUI_H
class testingUI
{
     public:
          testingUI();
          virtual ~testingUI();
     protected:
     private:
};
#endif // TESTINGUI_H
wxTestingApp.cpp
#include "wxTestingApp.h"
//(*AppHeaders
#include "wxTestingMain.h"
#include <wx/image.h>
//*)
IMPLEMENT_APP(wxTestingApp);
bool wxTestingApp::OnInit()
{
    //(*AppInitialize
    bool wxsOK = true;
    wxInitAllImageHandlers();
    if ( wxsOK )
    {
       wxTestingFrame* Frame = new wxTestingFrame(0);
       Frame->Show();
       SetTopWindow(Frame);
    }
    //*)
    return wxsOK;
}
wxTestingMain.cpp
#include "wxTestingMain.h"
#include <wx/msgdlg.h>
//(*InternalHeaders(wxTestingFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)
//helper functions
enum wxbuildinfoformat {
    short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
    wxString wxbuild(wxVERSION_STRING);
    if (format == long_f )
    {
#if defined(__WXMSW__)
        wxbuild << _T("-Windows");
#elif defined(__UNIX__)
        wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
        wxbuild << _T("-Unicode build");
#else
        wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
    }
    return wxbuild;
}
//(*IdInit(wxTestingFrame)
const long wxTestingFrame::idMenuQuit = wxNewId();
const long wxTestingFrame::idMenuAbout = wxNewId();
const long wxTestingFrame::ID_STATUSBAR1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(wxTestingFrame,wxFrame)
    //(*EventTable(wxTestingFrame)
    //*)
END_EVENT_TABLE()
wxTestingFrame::wxTestingFrame(wxWindow* parent,wxWindowID id)
{
    //(*Initialize(wxTestingFrame)
    wxMenu* Menu1;
    wxMenu* Menu2;
    wxMenuBar* MenuBar1;
    wxMenuItem* MenuItem1;
    wxMenuItem* MenuItem2;
    Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
    MenuBar1 = new wxMenuBar();
    Menu1 = new wxMenu();
    MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
    Menu1->Append(MenuItem1);
    MenuBar1->Append(Menu1, _("&File"));
    Menu2 = new wxMenu();
    MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
    Menu2->Append(MenuItem2);
    MenuBar1->Append(Menu2, _("Help"));
    SetMenuBar(MenuBar1);
    StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
    int __wxStatusBarWidths_1[1] = { -1 };
    int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
    StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
    StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
    SetStatusBar(StatusBar1);
    Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wxTestingFrame::OnQuit);
    Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wxTestingFrame::OnAbout);
    //*)
}
wxTestingFrame::~wxTestingFrame()
{
    //(*Destroy(wxTestingFrame)
    //*)
}
void wxTestingFrame::OnQuit(wxCommandEvent& event)
{
    Close();
}
void wxTestingFrame::OnAbout(wxCommandEvent& event)
{
    wxString msg = wxbuildinfo(long_f);
    wxMessageBox(msg, _("Welcome to..."));
}
wxTestingApp.h
#ifndef WXTESTINGAPP_H
#define WXTESTINGAPP_H
#include <wx/app.h>
#include "testingUI.h"
class wxTestingApp : public wxApp
{
    public:
        virtual bool OnInit();
};
#endif // WXTESTINGAPP_H
wxTestingMain.h
#ifndef WXTESTINGMAIN_H
#define WXTESTINGMAIN_H
#include "testingUI.h"
//(*Headers(wxTestingFrame)
#include <wx/frame.h>
#include <wx/menu.h>
#include <wx/statusbr.h>
//*)
class wxTestingFrame: public wxFrame
{
    public:
        wxTestingFrame(wxWindow* parent,wxWindowID id = -1);
        virtual ~wxTestingFrame();
    private:
        //(*Handlers(wxTestingFrame)
        void OnQuit(wxCommandEvent& event);
        void OnAbout(wxCommandEvent& event);
        //*)
        //(*Identifiers(wxTestingFrame)
        static const long idMenuQuit;
        static const long idMenuAbout;
        static const long ID_STATUSBAR1;
        //*)
        //(*Declarations(wxTestingFrame)
        wxStatusBar* StatusBar1;
        //*)
        DECLARE_EVENT_TABLE()
};
#endif // WXTESTINGMAIN_H
Good day.
I am trying to separate my main C++ model from the wxUI but have them be able to communicate with each other, above are the codes( the wxWidgets part is generated automatically). When I run the project it displays the window as wanted but the window disappears after few seconds.
I need help to achieve this and don't know where I go wrong.