wxProgressDialog



  • Hallo, hat jemand ne Ahnung wie man nen wxProgressDialog bei einem Kopier vorgang anwendet? Komm da nämlich echt nicht weiter...
    vielen dank im vorraus


  • Mod

    Manual: http://wxwidgets.org/manuals/2.6.2/wx_wxprogressdialog.html#wxprogressdialog

    Beispielprogramm:

    #include "wx/progdlg.h"
    
    void MyFrame::ShowProgress()
    {
        static const int max = 10;
    
        wxProgressDialog dialog(wxT("Progress dialog example"),
                                wxT("An informative message"),
                                max,    // range
                                this,   // parent
                                wxPD_CAN_ABORT |
                                wxPD_APP_MODAL |
                                wxPD_ELAPSED_TIME |
                                wxPD_ESTIMATED_TIME |
                                wxPD_REMAINING_TIME);
    
        bool cont = true;
        for ( int i = 0; i <= max; i++ )
        {
            wxSleep(1);
            if ( i == max )
                cont = dialog.Update(i, wxT("That's all, folks!"));
            else if ( i == max / 2 )
                cont = dialog.Update(i, wxT("Only a half left (very long message)!"));
            else
                cont = dialog.Update(i);
    
            if ( !cont )
            {
                if ( wxMessageBox(wxT("Do you really want to cancel?"),
                                  wxT("Progress dialog question"),
                                  wxYES_NO | wxICON_QUESTION) == wxYES )
                    break;
    
                dialog.Resume();
            }
        }
    
        if ( !cont )
            wxLogStatus(wxT("Progress dialog aborted!"));
        else
            wxLogStatus(wxT("Countdown from %d finished"), max);
    }
    

    Ansonsten findest du auch unter %wxWidgets%/samples/ zahlreiche Beispiele.

    phlox


Anmelden zum Antworten