wxWidgets進度條

Dsp Tian發表於2017-08-27
#include <wx/wx.h>
#include <wx/progdlg.h>

class myApp : public wxApp {
public:
    bool OnInit(void);
    int OnExit(void);
};

IMPLEMENT_APP(myApp)

    bool myApp :: OnInit(){
        int max = 500;

        wxFrame* frame = new wxFrame(NULL, wxID_ANY, wxT("blah blah"));
        this->SetTopWindow(frame);
        frame->Show(true);

        wxProgressDialog* dialog = new wxProgressDialog(wxT("Wait..."), wxT("Keep waiting..."), max, frame, wxPD_AUTO_HIDE | wxPD_APP_MODAL );
        
        for(int i = 0; i < max; i++){
            wxMilliSleep(10); //here are computations 
            dialog->Update(i,wxString::Format(wxT("%i"),i),NULL);
        }
    //    dialog->Update(max);
        delete dialog;

        return true;
}

int myApp :: OnExit(){

    return 0;
}

 

相關文章