X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71cf399ff0f1ddb966b48e512b0fb4e690f5c440..05e0b047d879cdbfade7f2ab346c0acdf3e29f96:/samples/grid/griddemo.cpp diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index a3c6b4287c..2cd20c56d4 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -336,14 +336,19 @@ GridFrame::GridFrame() grid->SetCellValue(5, 5, _T("Bg from row attr Text col from col attr and this text is so long that it covers over many many empty cells but is broken by one that isn't")); grid->SetColFormatFloat(6); - grid->SetCellValue(0, 6, _T("3.1415")); - grid->SetCellValue(1, 6, _T("1415")); - grid->SetCellValue(2, 6, _T("12345.67890")); + grid->SetCellValue(0, 6, wxString::Format(wxT("%g"), 3.1415)); + grid->SetCellValue(1, 6, wxString::Format(wxT("%g"), 1415.0)); + grid->SetCellValue(2, 6, wxString::Format(wxT("%g"), 12345.67890)); grid->SetColFormatFloat(7, 6, 2); - grid->SetCellValue(0, 7, _T("3.1415")); - grid->SetCellValue(1, 7, _T("1415")); - grid->SetCellValue(2, 7, _T("12345.67890")); + grid->SetCellValue(0, 7, wxString::Format(wxT("%g"), 3.1415)); + grid->SetCellValue(1, 7, wxString::Format(wxT("%g"), 1415.0)); + grid->SetCellValue(2, 7, wxString::Format(wxT("%g"), 12345.67890)); + + grid->SetColFormatNumber(8); + grid->SetCellValue(0, 8, "17"); + grid->SetCellValue(1, 8, "0"); + grid->SetCellValue(2, 8, "-666"); const wxString choices[] = { @@ -360,6 +365,12 @@ GridFrame::GridFrame() grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE); grid->SetCellValue(7, 1, _T("Big box!")); + // this does exactly nothing except testing that SetAttr() handles NULL + // attributes and does reference counting correctly + grid->SetAttr(11, 11, NULL); + grid->SetAttr(11, 11, new wxGridCellAttr); + grid->SetAttr(11, 11, NULL); + wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); topSizer->Add( grid, 1, @@ -371,10 +382,7 @@ GridFrame::GridFrame() wxEXPAND ); #endif // wxUSE_LOG - SetAutoLayout(true); - SetSizer( topSizer ); - - topSizer->Fit( this ); + SetSizerAndFit( topSizer ); Centre(); SetDefaults();