wxWidgets wizard structure


/ Published in: C++
Save to your folder(s)

OnRunWizard() function and simple wizard page class example.


Copy this code and paste it in your HTML
  1. void AClass::OnRunWizard() {
  2.  
  3. wxWizard *wizard = new wxWizard( this, -1, wxT("Title"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
  4.  
  5. Page1 *page1 = new Page1( wizard );
  6. Page2 *page2 = new Page2( wizard );
  7. Page3 *page3 = new Page3( wizard );
  8. Page4 *page4 = new Page4( wizard );
  9.  
  10. wxWizardPageSimple::Chain( page1, page2 );
  11. wxWizardPageSimple::Chain( page2, page3 );
  12. wxWizardPageSimple::Chain( page3, page4 );
  13.  
  14. wizard->GetPageAreaSizer()->Add( page1 );
  15.  
  16. if ( wizard->RunWizard(page1) ) {
  17.  
  18. wxMessageBox( wxT("Wizard is over."),
  19. wxT("The End"), wxICON_INFORMATION | wxOK);
  20. }
  21.  
  22. wizard->Destroy();
  23. }
  24.  
  25. class Page1 : public wxWizardPageSimple {
  26.  
  27. enum {
  28.  
  29. ID_DUMMY_VALUE_ //Dont Delete this DummyValue
  30. }; //End of Enum
  31.  
  32. public:
  33.  
  34. Page1 wxWizard *parent );
  35.  
  36. virtual bool TransferDataFromWindow();
  37.  
  38. private:
  39. };
  40.  
  41. bool Page1::TransferDataFromWindow() {
  42.  
  43. if ( condition ) {
  44.  
  45. wxMessageBox( wxT("Advice"),
  46. wxT("Error!"),
  47. wxICON_WARNING | wxOK, this );
  48. return false;
  49. }
  50.  
  51. return true;
  52. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.