My application flow let the user navigate from panel 1 to panel 3, at the end of the procedure, the user can load a new operation starting from panel 1.
I would like to reload the first panel by clearing all the forms and all the values previously changed by the user.
What is the best method?
I use changeselection() to navigate trough the panels, but this doesn't reset the panels (obviously).
Code: Select all
//isola02App.cpp
wxIMPLEMENT_APP(Isola02App);
bool Isola02App::OnInit()
{
Isola02Frame* frame = new Isola02Frame(L"Isola02Frame");
pointer = frame;
frame->Show(true);
wxInitAllImageHandlers();
m_timer.Bind(wxEVT_TIMER, &Isola02App::reset, this);
return true;
}
int Isola02App::FilterEvent(wxEvent &event)
{
if(event.GetEventType()==wxEVT_CHAR || event.GetEventType()==wxEVT_LEFT_DOWN ) {
m_timer.StartOnce(100*60*60);
printf("hey\n");
}
return -1;
}
void Isola02App::reset(wxTimerEvent&){
pointer->ShowPage(1);
printf("reset\n");
}
//isola02Main.cpp
Isola02Frame::Isola02Frame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
wxInitAllImageHandlers();
// Create a top-level panel to hold all the contents of the frame
//wxPanel* panel = new wxPanel(firstpanel, wxID_ANY);
// firstpanel* panel = new firstpanel(this, wxID_ANY);
// Create the wxNotebook widget
notebook = new wxSimplebook(this, wxID_ANY);
firstpanel *first = new firstpanel(notebook, this, wxID_ANY);
notebook->AddPage(first, L"first panel");
secondpanel *second = new secondpanel(notebook, this, wxID_ANY);
notebook->AddPage(second, L"second panel");
notebook->SetSelection(0);
ShowFullScreen(true);
}
void Isola02Frame::ShowPage(int page)
{
notebook->ChangeSelection(page);
}
//secondpanel.cpp
BEGIN_EVENT_TABLE(secondpanel,wxPanel)
//(*EventTable(secondpanel)
//*)
END_EVENT_TABLE()
secondpanel::secondpanel(wxWindow* parent, Isola02Frame *mainFrame, wxWindowID id,const wxPoint& pos,const wxSize& size)
{
pointer = mainFrame;
//(*Initialize(secondpanel)
Create(parent, wxID_ANY, wxPoint(-1,-1), wxSize(1323,827), wxTAB_TRAVERSAL, _T("wxID_ANY"));
SetMaxSize(wxSize(-1,-1));
SetBackgroundColour(wxColour(176,253,203));
selezione_tipologia = new wxStaticText(this, ID_STATICTEXT1, _("Seleziona il tipo di conferimento"), wxPoint(384,32), wxSize(792,42), 0, _T("ID_STATICTEXT1"));
wxFont selezione_tipologiaFont(26,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,_T("Sans"),wxFONTENCODING_DEFAULT);
selezione_tipologia->SetFont(selezione_tipologiaFont);
BitmapButton1 = new wxBitmapButton(this, ID_BITMAPBUTTON7, wxBitmap(wxImage(_T("/home/isola/Documents/Isola02/pics/remove-128.png"))), wxPoint(24,24), wxDefaultSize, wxBU_AUTODRAW|wxNO_BORDER, wxDefaultValidator, _T("ID_BITMAPBUTTON7"));
Connect(ID_BITMAPBUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&secondpanel::OnplasticaClick);
Connect(ID_BITMAPBUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&secondpanel::OnBitmapButton2Click);
Connect(ID_BITMAPBUTTON7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&secondpanel::OnBitmapButton1Click);
//*)
}
secondpanel::~secondpanel()
{
//(*Destroy(secondpanel)
//*)
}
void secondpanel::OnBitmapButton1Click(wxCommandEvent& event)
{
pointer->ShowPage(0);
}
Code: Select all
void secondpanel::OnBitmapButton1Click(wxCommandEvent& event)
{
pointer->ShowPage(0);
// pointer->notebook->Freeze();
// pointer->notebook->Thaw();
pointer->notebook->Update();
}