X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/41f02b9acc01217e918fa422298840df7cf6de25..48889bca6f8b2504f78c0f47b32f5e95c64d915d:/samples/grid/griddemo.cpp diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 5472db618d..37d438987e 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -139,7 +139,7 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_GRID_SELECT_CELL( GridFrame::OnSelectCell ) EVT_GRID_RANGE_SELECT( GridFrame::OnRangeSelected ) EVT_GRID_CELL_CHANGING( GridFrame::OnCellValueChanging ) - EVT_GRID_CELL_CHANGE( GridFrame::OnCellValueChanged ) + EVT_GRID_CELL_CHANGED( GridFrame::OnCellValueChanged ) EVT_GRID_CELL_BEGIN_DRAG( GridFrame::OnCellBeginDrag ) EVT_GRID_EDITOR_SHOWN( GridFrame::OnEditorShown ) @@ -377,6 +377,14 @@ GridFrame::GridFrame() grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE); grid->SetCellValue(7, 1, _T("Big box!")); + // create a separator-like row: it's grey and it's non-resizeable + grid->DisableRowResize(10); + grid->SetRowSize(10, 30); + attr = new wxGridCellAttr; + attr->SetBackgroundColour(*wxLIGHT_GREY); + grid->SetRowAttr(10, attr); + grid->SetCellValue(10, 0, "You can't resize this row interactively -- try it"); + // this does exactly nothing except testing that SetAttr() handles NULL // attributes and does reference counting correctly grid->SetAttr(11, 11, NULL); @@ -932,7 +940,10 @@ void GridFrame::OnCellLeftClick( wxGridEvent& ev ) void GridFrame::OnRowSize( wxGridSizeEvent& ev ) { - wxLogMessage(_T("Resized row %d"), ev.GetRowOrCol()); + const int row = ev.GetRowOrCol(); + + wxLogMessage("Resized row %d, new height = %d", + row, grid->GetRowSize(row)); ev.Skip(); } @@ -940,7 +951,10 @@ void GridFrame::OnRowSize( wxGridSizeEvent& ev ) void GridFrame::OnColSize( wxGridSizeEvent& ev ) { - wxLogMessage(_T("Resized col %d"), ev.GetRowOrCol()); + const int col = ev.GetRowOrCol(); + + wxLogMessage("Resized column %d, new width = %d", + col, grid->GetColSize(col)); ev.Skip(); } @@ -1152,6 +1166,13 @@ void GridFrame::About( wxCommandEvent& WXUNUSED(ev) ) aboutInfo.AddDeveloper(wxT("Julian Smart")); aboutInfo.AddDeveloper(wxT("Vadim Zeitlin")); + // this is just to force the generic version of the about + // dialog under wxMSW so that it's easy to test if the grid + // repaints correctly when it has lost focus and a dialog + // (different from the Windows standard message box -- it doesn't + // work with it for some reason) is moved over it. + aboutInfo.SetWebSite(wxT("http://www.wxwidgets.org")); + wxAboutBox(aboutInfo); } @@ -1877,7 +1898,7 @@ private: // fla for EVT_IDLE handler bool m_shouldUpdateOrder; - DECLARE_NO_COPY_CLASS(TabularGridFrame) + wxDECLARE_NO_COPY_CLASS(TabularGridFrame); DECLARE_EVENT_TABLE() };