Fixed a notebook crash and added more tests to sample.

Corrected size behaviour of default button.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-05-25 10:40:07 +00:00
parent 794005c0ac
commit 29f538cea2
8 changed files with 36 additions and 14 deletions

View File

@@ -58,7 +58,7 @@ bool MyApp::OnInit(void)
void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window)
{
m_okButton = new wxButton(window, wxID_OK, "Close", wxPoint(-1, -1), wxSize(80, 25));
m_cancelButton = new wxButton(window, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(80, 25));
m_cancelButton = new wxButton(window, ID_DELETE_PAGE, "Delete page", wxPoint(-1, -1), wxSize(80, 25));
m_addPageButton = new wxButton(window, ID_ADD_PAGE, "Add page", wxPoint(-1, -1), wxSize(80, 25));
m_okButton->SetDefault();
@@ -108,6 +108,11 @@ void MyApp::InitTabView(wxNotebook* notebook, wxWindow* window)
wxPanel *panel4 = new wxPanel(notebook, -1);
panel4->SetBackgroundColour(wxColour("YELLOW"));
notebook->AddPage(panel4, "Sheep");
wxPanel *panel5 = new wxPanel(notebook, -1);
panel5->SetBackgroundColour(wxColour("MAGENTA"));
(void)new wxStaticText(panel5, -1, "This page has been inserted, not added", wxPoint(10, 10) );
notebook->InsertPage(0, panel5, "Sheep");
}
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
@@ -154,7 +159,7 @@ void MyDialog::Init(void)
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_BUTTON(wxID_OK, MyFrame::OnOK)
EVT_BUTTON(wxID_CANCEL, MyFrame::OnOK)
EVT_BUTTON(ID_DELETE_PAGE, MyFrame::OnDeletePage)
EVT_BUTTON(ID_ADD_PAGE, MyFrame::OnAddPage)
EVT_SIZE(MyFrame::OnSize)
END_EVENT_TABLE()
@@ -176,6 +181,11 @@ void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
m_notebook->SetSelection( m_notebook->GetPageCount()-1 );
}
void MyFrame::OnDeletePage(wxCommandEvent& WXUNUSED(event))
{
m_notebook->DeletePage( m_notebook->GetPageCount()-1 );
}
void MyFrame::OnOK(wxCommandEvent& WXUNUSED(event) )
{
this->Destroy();