X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/50dd4ca957c21d42ce5c6bc4d69cd032d8d64e30..7f65743f005572f1de2754ba8c5e7cf1eed1847e:/samples/popup/popup.cpp diff --git a/samples/popup/popup.cpp b/samples/popup/popup.cpp index 8f5c2188b1..47b94bb0e0 100644 --- a/samples/popup/popup.cpp +++ b/samples/popup/popup.cpp @@ -124,8 +124,8 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent ) NULL, this); wxStaticText *text = new wxStaticText( m_panel, wxID_ANY, - wxT("wx.PopupTransientWindow is a\n") - wxT("wx.PopupWindow which disappears\n") + wxT("wxPopupTransientWindow is a\n") + wxT("wxPopupWindow which disappears\n") wxT("automatically when the user\n") wxT("clicks the mouse outside it or if it\n") wxT("(or its first child) loses focus in \n") @@ -142,7 +142,6 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent ) topSizer->Add( m_spinCtrl, 0, wxALL, 5 ); topSizer->Add( m_mouseText, 0, wxCENTRE|wxALL, 5 ); - m_panel->SetAutoLayout( true ); m_panel->SetSizer( topSizer ); topSizer->Fit(m_panel); topSizer->Fit(this); @@ -229,7 +228,7 @@ void SimpleTransientPopup::OnButton(wxCommandEvent& event) void SimpleTransientPopup::OnSpinCtrl(wxSpinEvent& event) { - wxLogMessage( wxT("0x%lx SimpleTransientPopup::OnSpinCtrl ID %d Value %ld"), long(this), event.GetId(), event.GetInt()); + wxLogMessage( wxT("0x%lx SimpleTransientPopup::OnSpinCtrl ID %d Value %d"), long(this), event.GetId(), event.GetInt()); event.Skip(); } @@ -289,6 +288,9 @@ IMPLEMENT_APP(MyApp) // 'Main program' equivalent: the program execution "starts" here bool MyApp::OnInit() { + if ( !wxApp::OnInit() ) + return false; + // create the main application window m_frame = new MyFrame(_T("Popup wxWidgets App")); @@ -315,7 +317,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) END_EVENT_TABLE() MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) +: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(500,300)) { m_simplePopup = m_scrolledPopup = NULL; @@ -355,14 +357,13 @@ MyFrame::MyFrame(const wxString& title) m_logWin->SetEditable(false); wxLogTextCtrl* logger = new wxLogTextCtrl( m_logWin ); m_logOld = logger->SetActiveTarget( logger ); - logger->SetTimestamp( NULL ); + logger->DisableTimestamp(); wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); topSizer->Add( button1, 0, wxALL, 5 ); topSizer->Add( button2, 0, wxALL, 5 ); topSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 5 ); - panel->SetAutoLayout( true ); panel->SetSizer( topSizer ); } @@ -449,9 +450,7 @@ MyDialog::MyDialog(const wxString& title) topSizer->AddSpacer(40); topSizer->Add( okButton, 0, wxALL, 5 ); - panel->SetAutoLayout( true ); - panel->SetSizer( topSizer ); - topSizer->Fit(this); + panel->SetSizerAndFit( topSizer ); } void MyDialog::OnStartSimplePopup(wxCommandEvent& event)