[ wxwindows-Bugs-1217401 ] wxGrid selection not working

SourceForge.net noreply at sourceforge.net
Wed Aug 8 02:43:05 PDT 2007


Bugs item #1217401, was opened at 2005-06-09 06:08
Message generated for change (Comment added) made by neis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1217401&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxGrid
Group: None
Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Brian Wallis (bwallis42)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxGrid selection not working

Initial Comment:
When I create a grid and register an event handler  
for a right button mouse click and also a 5 second  
timer. I never get any rows, cols or cells returned  
as selected regardless of how many I select.  
  
I've attached the simple example showing this  
behaviour.   
  
This is running on Gentoo linux (kernel 2.6.11,libc 
2.3.4), xorg 6.8, python 2.3.5, wxPython 2.4.2.4 or 
2.6.0.0 (tried both) and wxGTK 2.4.2 and 2.6.0. 
 

----------------------------------------------------------------------

>Comment By: Stefan Neis (neis)
Date: 2007-08-08 09:43

Message:
Logged In: YES 
user_id=32202
Originator: NO

Well, the problem is that originally that m_selection struct which the
GetSelectedCell/Rows/Cols and GetSelectionBlock... functions give access to
was meant to just be an efficient internal representation of the selection
state, with the officially available interface just being "IsInSelection".

However, "IsInSelection" turned out to be just not efficient enough
(especially for small changes in huge selections), and since nobody found
time to contribute an interface that's both efficient and comfortable, we
just added those functions giving access to the internal structures.

If anybody feels like contributing an interface which evaluates the
internal data and returns them in a more comfortable way, that would be
much appreciated. Be warned however, that just extending
GetSelectedRows/Cols/Cells to return an array of all selected
rows/cols/cells (possibly many many millions) is not acceptable.

One possibility could be an iterator that's iterating through all the
selected rows/cols/cells
in row/column/cell selection mode, which probably would be okay for row
and column selection mode, but iterating through all the individual cells
in cell selection mode might not be sufficiently efficient if there are
large blocks of selected cells, so I don't really know what to suggest
there...

----------------------------------------------------------------------

Comment By: Malcolm MacLeod (MaNI) (mmacleod)
Date: 2007-08-08 07:39

Message:
Logged In: YES 
user_id=1231512
Originator: NO

Ran into the same/similar issue here.
With wxGrid::wxGridSelectRows enabled if user clicks on a cell then
wxGrid::GetSelectedRows() does not return the selection, If he clicks on
the row heading then it does.

While it can be worked around (which is what I have done for now) I agree
with bwallis42 on both the issues he identified below.
I also think that this behaviour is both inconsistent and counter
intuative.

----------------------------------------------------------------------

Comment By: Brian Wallis (bwallis42)
Date: 2005-06-10 00:57

Message:
Logged In: YES 
user_id=613310

OK, had another play with it. The GetSelectionBlock... 
calls are useful and will help me work around the 
problem in my real app, thanks for that. 
 
But I still think it is inconsistent. If I set the grid selection 
mode to wxGridSelectRows I get different results for 
GetSelectedRows and GetSelectionBlock depending on 
whether I select the rows in the title column or in the 
body of the grid. If I select usingthe title column then I 
get a result in GetSelectedRows but *not* for 
GetSelectionBlock. If I select the rows in the body of the 
grid then it is the other way around. Selecting the whole 
table with the top left cell also returns no rows for 
GetSelectedRows. 
 
If I set wxGridSelectColumns mode then I get equivalent 
results. 
 
What this means is that I now think that there are two 
issues: 
1) the behaviour should be the same when you have the 
selection mode set to rows or columns and select via 
either the title or body 
2) GetSelectionBlock... should return the selection area 
when you select using the row or column title (it does if 
you select the whole table with the upper left cell) 

----------------------------------------------------------------------

Comment By: Robin Dunn (robind)
Date: 2005-06-09 15:52

Message:
Logged In: YES 
user_id=53955

There are different kinds of selections, so the results of
your test depend on how you make the selection.  If you
click or drag across the row labels then you will have row
selections, if you drag across the col labels then you will
have column selections.  If you select one or more single
cells (by ctrl clicking on them) then your test will report
selected cells.  The one thing you are not testing for is
range of cells selections, which is what you get when
dragging across cells.  You can get the range(s) of selected
cells with GetSelectionBlockTopLeft/GetSelectionBlockBottomRight


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1217401&group_id=9863




More information about the wx-dev mailing list