X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a68c1246db34618d4e60e2a6ccdac4f35700a3f1..f1567cddead054974c4a079ed8ee2c798ef998dc:/samples/newgrid/griddemo.cpp diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index 7272409b2e..1e3586dd3d 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -231,6 +231,16 @@ GridFrame::GridFrame() grid->SetColSize(4, 120); grid->SetColMinimalWidth(4, 120); + grid->SetColFormatFloat(5); + grid->SetCellValue(0, 5, "3.1415"); + grid->SetCellValue(1, 5, "1415"); + grid->SetCellValue(2, 5, "12345.67890"); + + grid->SetColFormatFloat(6, 6, 2); + grid->SetCellValue(0, 6, "3.1415"); + grid->SetCellValue(1, 6, "1415"); + grid->SetCellValue(2, 6, "12345.67890"); + wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); topSizer->Add( grid, 1, @@ -472,23 +482,27 @@ void GridFrame::InsertCol( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::DeleteSelectedRows( wxCommandEvent& WXUNUSED(ev) ) { +#if 0 if ( grid->IsSelection() ) { int topRow, bottomRow, leftCol, rightCol; grid->GetSelection( &topRow, &leftCol, &bottomRow, &rightCol ); grid->DeleteRows( topRow, bottomRow - topRow + 1 ); } +#endif } void GridFrame::DeleteSelectedCols( wxCommandEvent& WXUNUSED(ev) ) { +#if 0 if ( grid->IsSelection() ) { int topRow, bottomRow, leftCol, rightCol; grid->GetSelection( &topRow, &leftCol, &bottomRow, &rightCol ); grid->DeleteCols( leftCol, rightCol - leftCol + 1 ); } +#endif } @@ -659,9 +673,9 @@ void GridFrame::OnVTable(wxCommandEvent& ) s = wxGetTextFromUser( "Size of the table to create", "Size:", s ); - + s.ToLong( &s_sizeGrid ); - + #else s_sizeGrid = wxGetNumberFromUser("Size of the table to create", "Size: ", @@ -669,7 +683,7 @@ void GridFrame::OnVTable(wxCommandEvent& ) s_sizeGrid, 0, 32000, this); #endif - + if ( s_sizeGrid != -1 ) { BigGridFrame* win = new BigGridFrame(s_sizeGrid); @@ -805,20 +819,10 @@ static const wxChar* severities[] = static struct BugsGridData { int id; -#ifndef __BORLANDC__ - wxString -#else - const wxChar * -#endif - summary; + wxChar summary[80]; Severity severity; int prio; -#ifndef __BORLANDC__ - wxString -#else - const wxChar * -#endif - platform; + wxChar platform[12]; bool opened; } gs_dataBugsGrid [] = { @@ -854,8 +858,10 @@ wxString BugsGridTable::GetTypeName(int WXUNUSED(row), int col) // fall thorugh (TODO should be a list) case Col_Summary: + return wxString::Format(_T("%s:80"), wxGRID_VALUE_STRING); + case Col_Platform: - return wxGRID_VALUE_STRING; + return wxString::Format(_T("%s:all,MSW,GTK,other"), wxGRID_VALUE_CHOICE); case Col_Opened: return wxGRID_VALUE_BOOL; @@ -940,11 +946,11 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value ) break; case Col_Summary: - gd.summary = value; + wxStrncpy(gd.summary, value, WXSIZEOF(gd.summary)); break; case Col_Platform: - gd.platform = value; + wxStrncpy(gd.platform, value, WXSIZEOF(gd.platform)); break; } } @@ -1074,5 +1080,8 @@ BugsGridFrame::BugsGridFrame() grid->SetMargins(0, 0); grid->Fit(); - Fit(); + wxSize size = grid->GetSize(); + size.x += 10; + size.y += 10; + SetClientSize(size); }