From: Volker Bartheld on 20 Feb 2007 09:04 Hi! If you take a wxGrid with the wxGrid::wxGridSelectRows-style (see the sample below) and select multiple rows by holding the CTRL-key and clicking cells instead of row labels, wxGrid::GetSelectedRows()::size() will return 0 even though there are rows shown to be selected. Drag-LeftMouse across cells also doesn't work. Same thing happens for multiple selection onto row labels using SHIFT-LeftMouse instead of CTRL-LeftMouse. Dragging, however, works here. I assume the same happens with columns. Is that a bug or intended behaviour? Using wxMSG2.8.0rc1. Cheers, Volker <wxGridTest.cpp> #include <windows.h> #include <wx/grid.h> #include <wx/dialog.h> #include <wx/sizer.h> #include <wx/app.h> class MyGrid : public wxGrid { public: MyGrid( wxWindow *parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS, wxGridNameStr) {} void OnGridRangeSelect(wxGridRangeSelectEvent& evt) { wxArrayInt selRows=GetSelectedRows(); OutputDebugString((const wxChar*)wxString::Format(wxT("GetSelectedRows(): %u\n"), selRows.size()).c_str()); evt.Skip(); } DECLARE_EVENT_TABLE() }; BEGIN_EVENT_TABLE(MyGrid, wxGrid) EVT_GRID_RANGE_SELECT(MyGrid::OnGridRangeSelect) END_EVENT_TABLE() class MyDialog : public wxDialog { public: MyDialog::MyDialog() : wxDialog(NULL, wxID_ANY, wxT("wxGrid"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) { wxBoxSizer *pSizerV=new wxBoxSizer( wxVERTICAL ); MyGrid* pMyGrid=new MyGrid(this, wxID_ANY); pMyGrid->CreateGrid(3, 3, wxGrid::wxGridSelectRows); for(int i=0; i<pMyGrid->GetNumberRows(); ++i) for(int j=0; j<pMyGrid->GetNumberCols(); ++j) pMyGrid->SetCellValue(wxString::Format(wxT("%u"), i*pMyGrid->GetNumberCols()+j), i, j); pSizerV->Add(pMyGrid); SetSizer(pSizerV); } }; class MyApp: public wxApp { public: bool MyApp::OnInit() { MyDialog* TheDialog=new MyDialog(); TheDialog->Show(); return true; } }; IMPLEMENT_APP(MyApp) </wxGridTest.cpp> __ Mail replies to/an V B A R T H E L D at G M X dot D E
From: "John Labenski" on 20 Feb 2007 10:43 On 2/20/07, Volker Bartheld <dr_versaeg(a)freenet.de> wrote: > > Hi! > > If you take a wxGrid with the wxGrid::wxGridSelectRows-style (see the > sample below) and select multiple rows by holding the CTRL-key and > clicking cells instead of row labels, wxGrid::GetSelectedRows()::size() > will return 0 even though there are rows shown to be selected. > Drag-LeftMouse across cells also doesn't work. > > Same thing happens for multiple selection onto row labels using > SHIFT-LeftMouse instead of CTRL-LeftMouse. Dragging, however, works > here. > > I assume the same happens with columns. Is that a bug or intended > behaviour? It is intended, check GetSelectionBlockTopLeft() and GetSelectionBlockBottomRight(). Regards, John Labenski --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
|
Pages: 1 Prev: wxXmlDocument memory leak Next: a problem during compilation |