2016-11-22 2 views
1

wxWidgets 메인 프로그램이 없도록 app의 다른 부분에서 호출되는 app의 wxWidgets 구성 요소를 작성하려고합니다. 올바른 호출 순서를 찾는 데 문제가 있습니다. 내가 알고있는 것처럼wxWindows wx 주 프로그램없이 - 어떻게 코딩?

먼저 나는 wxApp를 서브 클래 싱해야합니다

TestApp* app = new TestApp(); 
    cerr << "a\n"; 
    wxApp::SetInstance(app); 
    cerr << "b\n"; 
    int argCount = 0; 
    char* argv[0]; 
    if(! wxEntryStart(argCount, argv)) { 
     cerr << "wx failed to start\n"; 
     wxExit(); 
    } 
    cerr << "d\n"; 
    int res = wxGetApp().OnRun(); 

하지만 결코 호출하지 : 내가 wxWidgets에를 시작하려고 할 때

class TestApp : public wxApp { 
public: 
    virtual bool OnInit() override; 
}; 
bool TestApp::OnInit() { 
    cerr << "app init\n"<<flush; 
} 

은 그 때 나는 이런 식으로 뭔가를 할 필요가 OnInit(). 아무도 내가해야 할 일을 알고 있습니까?

이 질문은하지는 (그래서 그들은 wxEntryStart()을 원하는) 이벤트 루프를 호출 할 할 점에서 wxWidgets: How to initialize wxApp without using macros and without entering the main application loop? 다른 그러나 나는는 (그래서, 알고 보니, 내가 wxEntry()을 원하는) 이벤트 루프를 싶어 .

+0

가능한 복제 [wxWidgets에 : 매크로를 사용하지 않고 기본 응용 프로그램 루프를 입력하지 않고 wxApp를 초기화하는 방법 (http://stackoverflow.com/questions/208373/wxwidgets- how-to-initialize-wxapp-without-using-macros-and-without-entered-the) – axalis

답변