wxWidgets进度条

#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;
}

 

posted @ 2017-08-27 16:58  Dsp Tian  阅读(949)  评论(0编辑  收藏  举报