#include "Base.h" #include // This statement initializes the whole application and calls OnInit MyApp myApp; // Globally declared variables wxText *value; // Process a button click void button_proc(wxButton& button, wxCommandEvent& ) { value->SetValue(itoa( atoi(value->GetValue())+1 )); myApp.Refresh(); } // "main()" equivalent, creating windows and returning main app frame wxFrame *MyApp::OnInit(void) { // Create the main frame window frame = new wxFrame(NULL, "Start Window", 1, 1, 300, 100); panel = new wxPanel(frame, -1, -1, -1, -1); button = new wxButton(panel, (wxFunction)&button_proc , "Increment"); button->SetSize(150,10,60,-1,wxSIZE_AUTO_HEIGHT); value= new wxText(panel, NULL, "Count : ","",100,30,35,-1,0,""); value->SetSize(10,10,90,-1,wxSIZE_AUTO_HEIGHT); value->SetValue(itoa(0)); frame->Center(wxBOTH); frame->Show(TRUE); return frame; // *MUST* return pointer to wxFrame } void MyApp::Refresh() { frame->Refresh(); } void MyApp::OnClose() {delete frame; } char* itoa(int num) { char temp[10]; sprintf(temp, "%d", num); int length = strlen(temp); char* result = new char[length]; strcpy(result,temp); return result; }